Auto-release static GDTypes at exit.
This fixes "unclaimed StringName" warnings and improves engine shutdown correctness.
This commit is contained in:
parent
64bc9a25a3
commit
17ef5afa6c
3 changed files with 17 additions and 1 deletions
|
|
@ -2420,6 +2420,7 @@ void ClassDB::cleanup_defaults() {
|
|||
default_values_cached.clear();
|
||||
}
|
||||
|
||||
LocalVector<GDType **> ClassDB::gdtype_autorelease_pool;
|
||||
void ClassDB::cleanup() {
|
||||
//OBJTYPE_LOCK; hah not here
|
||||
|
||||
|
|
@ -2440,6 +2441,15 @@ void ClassDB::cleanup() {
|
|||
resource_base_extensions.clear();
|
||||
compat_classes.clear();
|
||||
native_structs.clear();
|
||||
|
||||
for (GDType **type : gdtype_autorelease_pool) {
|
||||
if (!type) {
|
||||
WARN_PRINT("GDType in autorelease pool was cleaned up before being auto-released. Ignoring.");
|
||||
}
|
||||
memdelete(*type);
|
||||
*type = nullptr;
|
||||
}
|
||||
gdtype_autorelease_pool.clear();
|
||||
}
|
||||
|
||||
// Array to use in optional parameters on methods and the DEFVAL_ARRAY macro.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue