summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-01-02 14:50:02 +0100
committerRémi Verschelde <rverschelde@gmail.com>2020-01-02 14:51:50 +0100
commite772a1241ae5d82ab88e6079352c55e5ef466164 (patch)
tree9ef6935c37a7a7fdbd9d515a754ec86e1aef7d40
parentc0ece451e39b440b758cc8621fccff0a4f898f22 (diff)
Object::disconnect: Better errors when no signal or locked
It will now give information about the originating object instance and when locked, the target callback. This should help debugging editor and game issues that are now being reported due to adding signal locking in 22637beb2ed625c3e43ab75ab5865b57d7470948.
-rw-r--r--core/object.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/object.cpp b/core/object.cpp
index 57fd730f7f..984c2e3c55 100644
--- a/core/object.cpp
+++ b/core/object.cpp
@@ -1517,9 +1517,11 @@ void Object::_disconnect(const StringName &p_signal, Object *p_to_object, const
ERR_FAIL_NULL(p_to_object);
Signal *s = signal_map.getptr(p_signal);
- ERR_FAIL_COND_MSG(!s, "Nonexistent signal: " + p_signal + ".");
+ ERR_FAIL_COND_MSG(!s, vformat("Nonexistent signal '%s' in %s.", p_signal, to_string()));
- 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.");
+ ERR_FAIL_COND_MSG(s->lock > 0,
+ vformat("Attempt to disconnect %s signal '%s' while in emission callback '%s' (in target %s). Use CONNECT_DEFERRED (to be able to safely disconnect) or CONNECT_ONESHOT (for automatic disconnection) as connection flags.",
+ to_string(), p_signal, p_to_method, p_to_object->to_string()));
Signal::Target target(p_to_object->get_instance_id(), p_to_method);