From 41f59ecfca6ddea1eb7b023aaea75e80e3c30c5c Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Wed, 22 Jan 2020 01:45:06 +0100 Subject: Make sure we know when deleting an emitting object We used a lock signals in the signal_map while emitting, because it was not allowed to disconnect them while being emitted. We used that lock to check if we where deleting an object during signal emission. Now that we allow to disconnect signals while they are being emitted, if an object first disconnects, then gets deleted we can't know that a signal was being emitted during the destructor. This commit adds a new `_emitting` boolean member to Object to be set while emitting and checked in the destructor, while removing the old signal lock which is now unused. --- core/object.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/object.h') diff --git a/core/object.h b/core/object.h index ad1865da7b..865c155764 100644 --- a/core/object.h +++ b/core/object.h @@ -465,8 +465,7 @@ private: MethodInfo user; VMap slot_map; - int lock; - Signal() { lock = 0; } + Signal() {} }; HashMap signal_map; @@ -481,6 +480,7 @@ private: bool _predelete(); void _postinitialize(); bool _can_translate; + bool _emitting; #ifdef TOOLS_ENABLED bool _edited; uint32_t _edited_version; -- cgit v1.2.3