mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Add a safety check for CowData::_unref(), for when something tries to add elements during destruction.
This commit is contained in:
parent
99f5a3d665
commit
d2d57849de
1 changed files with 6 additions and 0 deletions
|
|
@ -282,6 +282,12 @@ void CowData<T>::_unref() {
|
|||
|
||||
// Free memory.
|
||||
Memory::free_static((uint8_t *)prev_ptr - DATA_OFFSET, false);
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
// If any destructors access us through pointers, it is a bug.
|
||||
// We can't really test for that, but we can at least check no items have been added.
|
||||
ERR_FAIL_COND_MSG(_ptr != nullptr, "Internal bug, please report: CowData was modified during destruction.");
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue