1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-17 14:11:06 +00:00

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.
This commit is contained in:
Fabio Alessandrelli
2020-01-22 01:45:06 +01:00
parent 5127afa812
commit 41f59ecfca
2 changed files with 10 additions and 9 deletions

View File

@@ -465,8 +465,7 @@ private:
MethodInfo user;
VMap<Target, Slot> slot_map;
int lock;
Signal() { lock = 0; }
Signal() {}
};
HashMap<StringName, Signal> 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;