Skip to content

Commit

Permalink
Fix for opende heightfield and console spam (#3271)
Browse files Browse the repository at this point in the history
* opende heightfield: fix memory access bug

Port fix from bitbucket:
odedevs/ode@63caf226abf3be2225972955bec828f65887886f

Original message: oleh_derevenko#1921: Fixed:
A bug with heightfield data assigned to a wrong field in
dGeomHeightfieldSetHeightfieldData (bug report #88 by Luc).

* Visual::CreateDynamicLine check connection

Only call ConnectPreRender if a Visual doesn't
already have a ConnectionPtr, since reassigning
it may generate console errors like:

[Event.cc:61] Warning: Deleting a connection right after creation.
Make sure to save the ConnectionPtr from a Connect call.

In particular, the OriginVisual calls CreateDynamicLine
three times in succession, which may be a source of these
console messages.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored Oct 28, 2022
1 parent 5bb2ff2 commit 94adc32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deps/opende/src/heightfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ dGeomID dCreateHeightfield( dSpaceID space, dHeightfieldDataID data, int bPlacea
void dGeomHeightfieldSetHeightfieldData( dGeomID g, dHeightfieldDataID d )
{
dxHeightfield* geom = (dxHeightfield*) g;
geom->data = d;
geom->m_p_data = d;
}


Expand Down
7 changes: 5 additions & 2 deletions gazebo/rendering/Visual.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2180,8 +2180,11 @@ void Visual::SetRibbonTrail(bool _value,
//////////////////////////////////////////////////
DynamicLines *Visual::CreateDynamicLine(RenderOpType _type)
{
this->dataPtr->preRenderConnection = event::Events::ConnectPreRender(
boost::bind(&Visual::Update, this));
if (!this->dataPtr->preRenderConnection)
{
this->dataPtr->preRenderConnection = event::Events::ConnectPreRender(
boost::bind(&Visual::Update, this));
}

DynamicLines *line = new DynamicLines(_type);
this->dataPtr->lines.push_back(line);
Expand Down

0 comments on commit 94adc32

Please sign in to comment.