From 28599e6c2092a1b4e5a9cd7a831efbaed479c3be Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 18 Dec 2019 19:31:10 -0300 Subject: [PATCH] Suggest use of deferred or oneshot on disconnect if the signal is locked. Closes #34443. --- core/object.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/object.cpp b/core/object.cpp index e1bc4b97f0e..b643aecdd81 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -1519,7 +1519,7 @@ void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const Signal *s = signal_map.getptr(p_signal); ERR_FAIL_COND_MSG(!s, "Nonexistent signal: " + p_signal + "."); - ERR_FAIL_COND_MSG(s->lock > 0, "Attempt to disconnect signal '" + p_signal + "' while emitting (locks: " + itos(s->lock) + ")."); + ERR_FAIL_COND_MSG(s->lock > 0, "Attempt to disconnect signal '" + p_signal + "' while in emission callback. Use CONNECT_DEFERRED (to be able to safely disconnect) or CONNECT_ONESHOT (for automatic disconnection) as connection flags."); Signal::Target target(p_to_object->get_instance_id(), p_to_method);