You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-28 16:07:14 +00:00
Resolve GDScript::clear() heap-use-after-free ASAN errors
This commit is contained in:
@@ -62,7 +62,6 @@ class GDScript : public Script {
|
||||
bool tool = false;
|
||||
bool valid = false;
|
||||
bool reloading = false;
|
||||
bool skip_dependencies = false;
|
||||
|
||||
struct MemberInfo {
|
||||
int index = 0;
|
||||
@@ -71,6 +70,15 @@ class GDScript : public Script {
|
||||
GDScriptDataType data_type;
|
||||
};
|
||||
|
||||
struct ClearData {
|
||||
RBSet<GDScriptFunction *> functions;
|
||||
RBSet<Ref<Script>> scripts;
|
||||
void clear() {
|
||||
functions.clear();
|
||||
scripts.clear();
|
||||
}
|
||||
};
|
||||
|
||||
friend class GDScriptInstance;
|
||||
friend class GDScriptFunction;
|
||||
friend class GDScriptAnalyzer;
|
||||
@@ -157,7 +165,7 @@ class GDScript : public Script {
|
||||
|
||||
bool _update_exports(bool *r_err = nullptr, bool p_recursive_call = false, PlaceHolderScriptInstance *p_instance_to_update = nullptr);
|
||||
|
||||
void _save_orphaned_subclasses();
|
||||
void _save_orphaned_subclasses(GDScript::ClearData *p_clear_data);
|
||||
void _init_rpc_methods_properties();
|
||||
|
||||
void _get_script_property_list(List<PropertyInfo> *r_list, bool p_include_base) const;
|
||||
@@ -180,7 +188,7 @@ protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
void clear();
|
||||
void clear(GDScript::ClearData *p_clear_data = nullptr);
|
||||
|
||||
virtual bool is_valid() const override { return valid; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user