summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authoradmix <eugene.andreeshchev@gmail.com>2015-11-28 19:53:05 +0100
committerkoalefant <mandarin.cake@gmail.com>2015-11-29 17:02:52 +0100
commitb2508ca879cfeee6edb5e6a7722cf85243a5a88f (patch)
tree242f9c12cbe74812ddfee51fc0cf40d9efd4214d /modules
parentb0dbcccb6c430cdf8a8f050676427f2414037ef7 (diff)
Break into GDScript debugger when new() fails
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gd_script.cpp14
-rw-r--r--modules/gdscript/gd_script.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 99ddc74bb4..8746f92c9e 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -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 */
@@ -1465,14 +1465,13 @@ GDInstance* GDScript::_create_instance(const Variant** p_args,int p_argcount,Obj
instances.insert(instance->owner);
- Variant::CallError err;
- initializer->call(instance,p_args,p_argcount,err);
+ initializer->call(instance,p_args,p_argcount,r_error);
- if (err.error!=Variant::CallError::CALL_OK) {
+ if (r_error.error!=Variant::CallError::CALL_OK) {
instance->script=Ref<GDScript>();
instance->owner->set_script_instance(NULL);
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
@@ -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 (ref.is_null()) {
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 {
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 37ef47af6c..850ffec05f 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -286,7 +286,7 @@ friend class GDScriptLanguage;
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);