Break into GDScript debugger when new() fails
This commit is contained in:
parent
b0dbcccb6c
commit
b2508ca879
2 changed files with 8 additions and 8 deletions
|
@ -1449,7 +1449,7 @@ Object *GDNativeClass::instance() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Object *p_owner,bool p_isref) {
|
GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Object *p_owner,bool p_isref,Variant::CallError& r_error) {
|
||||||
|
|
||||||
|
|
||||||
/* STEP 1, CREATE */
|
/* STEP 1, CREATE */
|
||||||
|
@ -1465,14 +1465,13 @@ GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Obj
|
||||||
|
|
||||||
instances.insert(instance->owner);
|
instances.insert(instance->owner);
|
||||||
|
|
||||||
Variant::CallError err;
|
initializer->call(instance,p_args,p_argcount,r_error);
|
||||||
initializer->call(instance,p_args,p_argcount,err);
|
|
||||||
|
|
||||||
if (err.error!=Variant::CallError::CALL_OK) {
|
if (r_error.error!=Variant::CallError::CALL_OK) {
|
||||||
instance->script=Ref<GDScript>();
|
instance->script=Ref<GDScript>();
|
||||||
instance->owner->set_script_instance(NULL);
|
instance->owner->set_script_instance(NULL);
|
||||||
instances.erase(p_owner);
|
instances.erase(p_owner);
|
||||||
ERR_FAIL_COND_V(err.error!=Variant::CallError::CALL_OK, NULL); //error consrtucting
|
ERR_FAIL_COND_V(r_error.error!=Variant::CallError::CALL_OK, NULL); //error constructing
|
||||||
}
|
}
|
||||||
|
|
||||||
//@TODO make thread safe
|
//@TODO make thread safe
|
||||||
|
@ -1505,7 +1504,7 @@ Variant GDScript::_new(const Variant** p_args,int p_argcount,Variant::CallError&
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GDInstance* instance = _create_instance(p_args,p_argcount,owner,r!=NULL);
|
GDInstance* instance = _create_instance(p_args,p_argcount,owner,r!=NULL,r_error);
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
if (ref.is_null()) {
|
if (ref.is_null()) {
|
||||||
memdelete(owner); //no owner, sorry
|
memdelete(owner); //no owner, sorry
|
||||||
|
@ -1637,7 +1636,8 @@ ScriptInstance* GDScript::instance_create(Object *p_this) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _create_instance(NULL,0,p_this,p_this->cast_to<Reference>());
|
Variant::CallError unchecked_error;
|
||||||
|
return _create_instance(NULL,0,p_this,p_this->cast_to<Reference>(),unchecked_error);
|
||||||
|
|
||||||
}
|
}
|
||||||
bool GDScript::instance_has(const Object *p_this) const {
|
bool GDScript::instance_has(const Object *p_this) const {
|
||||||
|
|
|
@ -286,7 +286,7 @@ friend class GDScriptLanguage;
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
|
|
||||||
GDInstance* _create_instance(const Variant** p_args,int p_argcount,Object *p_owner,bool p_isref);
|
GDInstance* _create_instance(const Variant** p_args,int p_argcount,Object *p_owner,bool p_isref,Variant::CallError &r_error);
|
||||||
|
|
||||||
void _set_subclass_path(Ref<GDScript>& p_sc,const String& p_path);
|
void _set_subclass_path(Ref<GDScript>& p_sc,const String& p_path);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue