Skip to content

Commit

Permalink
Merge pull request #48591 from trollodel/collisionobject3d-fix-discon…
Browse files Browse the repository at this point in the history
…nect

Use the correct method in shape_owner_remove_shape
  • Loading branch information
akien-mga authored May 9, 2021
2 parents aac0145 + a24c46e commit 87f8feb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions scene/3d/collision_object_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void CollisionObject3D::_update_shape_data(uint32_t p_owner) {
}
}

void CollisionObject3D::_shape_changed(Ref<Shape3D> p_shape) {
void CollisionObject3D::_shape_changed(const Ref<Shape3D> &p_shape) {
for (Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) {
ShapeData &shapedata = E->get();
ShapeData::ShapeBase *shapes = shapedata.shapes.ptrw();
Expand Down Expand Up @@ -485,8 +485,8 @@ void CollisionObject3D::shape_owner_remove_shape(uint32_t p_owner, int p_shape)

if (s.debug_shape.is_valid()) {
RS::get_singleton()->free(s.debug_shape);
if (s.shape.is_valid() && s.shape->is_connected("changed", callable_mp(this, &CollisionObject3D::_update_shape_data))) {
s.shape->disconnect("changed", callable_mp(this, &CollisionObject3D::_update_shape_data));
if (s.shape.is_valid() && s.shape->is_connected("changed", callable_mp(this, &CollisionObject3D::_shape_changed))) {
s.shape->disconnect("changed", callable_mp(this, &CollisionObject3D::_shape_changed));
}
--debug_shapes_count;
}
Expand Down
2 changes: 1 addition & 1 deletion scene/3d/collision_object_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class CollisionObject3D : public Node3D {

bool _are_collision_shapes_visible();
void _update_shape_data(uint32_t p_owner);
void _shape_changed(Ref<Shape3D> p_shape);
void _shape_changed(const Ref<Shape3D> &p_shape);
void _update_debug_shapes();
void _clear_debug_shapes();

Expand Down

0 comments on commit 87f8feb

Please sign in to comment.