Skip to content

Commit 0d2c295

Browse files
authored
Merge pull request #6692 from cyberbotics/sync-master-3e3c5214c
Merge master into develop
2 parents 22f508a + 44ae934 commit 0d2c295

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

docs/reference/changelog-r2024.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ Released on December **th, 2023.
4141
- Fixed error on macos when when putting displays and cameras in separate windows ([#6635](https://github.com/cyberbotics/webots/pull/6635)).
4242
- Fixed crash when `wb_supervisor_field_get_name` was called with NULL ([#6647](https://github.com/cyberbotics/webots/pull/6647)).
4343
- Fixed bug where the wrong y coordinate was used for one corner of the box drawn to represent a box-plane collision ([#6677](https://github.com/cyberbotics/webots/pull/6677)).
44+
- Fixed a bug where Webots would crash if a geometry was inserted into a `Shape` node used a bounding box ([#6691](https://github.com/cyberbotics/webots/pull/6691)).
4445
- Fixed handling of remote assets from unofficial sources ([#6585](https://github.com/cyberbotics/webots/pull/6585)).

src/webots/nodes/WbGeometry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ void WbGeometry::setOdeMass(const dMass *mass) {
466466
}
467467

468468
void WbGeometry::setOdeData(dGeomID geom, WbMatter *matterAncestor) {
469-
assert(geom && matterAncestor);
469+
assert(geom && geom != mOdeGeom && matterAncestor);
470470

471471
if (!areOdeObjectsCreated())
472472
createOdeObjects();

src/webots/nodes/WbMatter.cpp

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ dGeomID WbMatter::createOdeGeomFromGeometry(dSpaceID space, WbGeometry *geometry
279279
dGeomID geom = geometry->createOdeGeom(space);
280280

281281
if (geom && setOdeData) {
282+
// Stores a pointer to the ODE geometry into the WbGeometry node & sets the WbGeometry node and its WbMatter parent node as
283+
// reference data
282284
geometry->setOdeData(geom, this);
283285
connect(geometry, &WbGeometry::boundingGeometryRemoved, this, &WbMatter::removeBoundingGeometry, Qt::UniqueConnection);
284286
}
@@ -333,16 +335,7 @@ dGeomID WbMatter::createOdeGeomFromPose(dSpaceID space, WbPose *pose) {
333335
if (eg) // TODO: rename slot?
334336
connect(eg, &WbElevationGrid::validElevationGridInserted, pose, &WbPose::geometryInPoseInserted, Qt::UniqueConnection);
335337

336-
dGeomID geom = createOdeGeomFromGeometry(space, geometry, false);
337-
if (geom == NULL)
338-
return NULL;
339-
340-
// Stores a pointer to the ODE geometry into the WbGeometry node & sets the WbGeometry node and its WbMatter parent node as
341-
// reference data
342-
geometry->setOdeData(geom, this);
343-
connect(geometry, &WbGeometry::boundingGeometryRemoved, this, &WbMatter::removeBoundingGeometry, Qt::UniqueConnection);
344-
345-
return geom;
338+
return createOdeGeomFromGeometry(space, geometry);
346339
}
347340

348341
void WbMatter::createOdeGeomFromInsertedPoseItem() {
@@ -382,10 +375,7 @@ void WbMatter::createOdeGeomFromInsertedShapeItem() {
382375
assert(ifs || eg);
383376
return;
384377
}
385-
// Stores a pointer to the ODE geometry into the WbGeometry node & sets the WbGeometry node and its WbMatter parent node as
386-
// reference data
387-
geometry->setOdeData(insertedGeom, this);
388-
connect(geometry, &WbGeometry::boundingGeometryRemoved, this, &WbMatter::removeBoundingGeometry, Qt::UniqueConnection);
378+
389379
setGeomMatter(insertedGeom, geometry);
390380
}
391381

0 commit comments

Comments
 (0)