diff options
author | George Marques <george@gmarqu.es> | 2024-01-17 11:27:40 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2024-01-18 09:33:44 -0300 |
commit | b4e08eb752cca0135208ed0729479e1d9c87773d (patch) | |
tree | ca64814ba09a6ef6b4ca9904d2902c65b3faec4d /core/object/class_db.cpp | |
parent | 107f2961ccfac179af7682eb5f6e7ea91e80040c (diff) | |
download | redot-engine-b4e08eb752cca0135208ed0729479e1d9c87773d.tar.gz |
Allow `free()` to be used as Callable
This method is registered in a special way so ClassDB doesn't naturally
know about its existence. Here it is hardcoded if any other option fail
to check if it is about the `free()` method and, if so, say it exists
and return a Callable.
Diffstat (limited to 'core/object/class_db.cpp')
-rw-r--r-- | core/object/class_db.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp index bf1bd0de93..45fbb19f88 100644 --- a/core/object/class_db.cpp +++ b/core/object/class_db.cpp @@ -31,6 +31,7 @@ #include "class_db.h" #include "core/config/engine.h" +#include "core/core_string_names.h" #include "core/io/resource_loader.h" #include "core/object/script_language.h" #include "core/os/mutex.h" @@ -1299,6 +1300,12 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia check = check->inherits_ptr; } + // The "free()" method is special, so we assume it exists and return a Callable. + if (p_property == CoreStringNames::get_singleton()->_free) { + r_value = Callable(p_object, p_property); + return true; + } + return false; } |