mirror of
https://github.com/godotengine/godot.git
synced 2024-11-29 23:53:08 +00:00
Merge pull request #36358 from vnen/gdscript-variant-ref-fix
Remove static script reference from GDScript class
This commit is contained in:
commit
b5729a82e9
@ -1410,10 +1410,7 @@ Variant ClassDB::class_get_default_property_value(const StringName &p_class, con
|
||||
cleanup_c = false;
|
||||
} else if (ClassDB::can_instance(p_class)) {
|
||||
c = ClassDB::instance(p_class);
|
||||
#ifndef _MSC_VER
|
||||
#warning FIXME: ObjectID refactoring broke GDScript handling of reference pointers, this needs a proper fix.
|
||||
#endif
|
||||
cleanup_c = (p_class != StringName("GDScript"));
|
||||
cleanup_c = true;
|
||||
}
|
||||
|
||||
if (c) {
|
||||
|
@ -995,7 +995,6 @@ void GDScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
|
||||
GDScript::GDScript() :
|
||||
script_list(this) {
|
||||
|
||||
_static_ref = this;
|
||||
valid = false;
|
||||
subclass_count = 0;
|
||||
initializer = NULL;
|
||||
|
@ -73,7 +73,6 @@ class GDScript : public Script {
|
||||
friend class GDScriptFunctions;
|
||||
friend class GDScriptLanguage;
|
||||
|
||||
Variant _static_ref; //used for static call
|
||||
Ref<GDScriptNativeClass> native;
|
||||
Ref<GDScript> base;
|
||||
GDScript *_base; //fast pointer access
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "gdscript.h"
|
||||
#include "gdscript_functions.h"
|
||||
|
||||
Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant *p_stack, String &r_error) const {
|
||||
Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant &static_ref, Variant *p_stack, String &r_error) const {
|
||||
|
||||
int address = p_address & ADDR_MASK;
|
||||
|
||||
@ -52,7 +52,7 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta
|
||||
} break;
|
||||
case ADDR_TYPE_CLASS: {
|
||||
|
||||
return &p_script->_static_ref;
|
||||
return &static_ref;
|
||||
} break;
|
||||
case ADDR_TYPE_MEMBER: {
|
||||
#ifdef DEBUG_ENABLED
|
||||
@ -270,6 +270,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
||||
r_err.error = Variant::CallError::CALL_OK;
|
||||
|
||||
Variant self;
|
||||
Variant static_ref;
|
||||
Variant retvalue;
|
||||
Variant *stack = NULL;
|
||||
Variant **call_args;
|
||||
@ -404,10 +405,10 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
||||
#define CHECK_SPACE(m_space) \
|
||||
GD_ERR_BREAK((ip + m_space) > _code_size)
|
||||
|
||||
#define GET_VARIANT_PTR(m_v, m_code_ofs) \
|
||||
Variant *m_v; \
|
||||
m_v = _get_variant(_code_ptr[ip + m_code_ofs], p_instance, script, self, stack, err_text); \
|
||||
if (unlikely(!m_v)) \
|
||||
#define GET_VARIANT_PTR(m_v, m_code_ofs) \
|
||||
Variant *m_v; \
|
||||
m_v = _get_variant(_code_ptr[ip + m_code_ofs], p_instance, script, self, static_ref, stack, err_text); \
|
||||
if (unlikely(!m_v)) \
|
||||
OPCODE_BREAK;
|
||||
|
||||
#else
|
||||
@ -415,7 +416,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
||||
#define CHECK_SPACE(m_space)
|
||||
#define GET_VARIANT_PTR(m_v, m_code_ofs) \
|
||||
Variant *m_v; \
|
||||
m_v = _get_variant(_code_ptr[ip + m_code_ofs], p_instance, script, self, stack, err_text);
|
||||
m_v = _get_variant(_code_ptr[ip + m_code_ofs], p_instance, script, self, static_ref, stack, err_text);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -265,7 +265,7 @@ private:
|
||||
|
||||
List<StackDebug> stack_debug;
|
||||
|
||||
_FORCE_INLINE_ Variant *_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant *p_stack, String &r_error) const;
|
||||
_FORCE_INLINE_ Variant *_get_variant(int p_address, GDScriptInstance *p_instance, GDScript *p_script, Variant &self, Variant &static_ref, Variant *p_stack, String &r_error) const;
|
||||
_FORCE_INLINE_ String _get_call_error(const Variant::CallError &p_err, const String &p_where, const Variant **argptrs) const;
|
||||
|
||||
friend class GDScriptLanguage;
|
||||
|
Loading…
Reference in New Issue
Block a user