Skip to content

Commit

Permalink
Avoid potential crash on signal disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomShaper committed Jul 23, 2024
1 parent 26d1577 commit fb76ba6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/object/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2097,10 +2097,10 @@ Object::~Object() {
// Disconnect signals that connect to this object.
while (connections.size()) {
Connection c = connections.front()->get();
bool disconnected = c.signal.get_object()->_disconnect(c.signal.get_name(), c.callable, true);
if (unlikely(!disconnected)) {
// If the disconnect has failed, abandon the connection to avoid getting trapped in an infinite loop here.
connections.pop_front();
Object *obj = c.callable.get_object();
bool disconnected = false;

Check failure on line 2101 in core/object/object.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor w/ Mono (target=editor)

variable 'disconnected' set but not used [-Werror=unused-but-set-variable]

Check failure on line 2101 in core/object/object.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, scu_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=gold)

variable 'disconnected' set but not used [-Werror=unused-but-set-variable]

Check failure on line 2101 in core/object/object.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Template w/ Mono (target=template_release)

variable 'disconnected' set but not used [-Werror=unused-but-set-variable]

Check failure on line 2101 in core/object/object.cpp

View workflow job for this annotation

GitHub Actions / 🐧 Linux / Minimal template (target=template_release, everything disabled)

variable 'disconnected' set but not used [-Werror=unused-but-set-variable]
if (likely(obj)) {
disconnected = c.signal.get_object()->_disconnect(c.signal.get_name(), c.callable, true);
}
}

Expand Down

0 comments on commit fb76ba6

Please sign in to comment.