Merge pull request #3170 from leezh/subclass_segfault_fix

added missing onready allocation for subclasses
This commit is contained in:
Rémi Verschelde 2015-12-30 09:35:44 +01:00
commit ac13c8c0c6
2 changed files with 3 additions and 1 deletions

View File

@ -1218,7 +1218,7 @@ Error GDCompiler::_parse_function(GDScript *p_script,const GDParser::ClassNode *
bool is_initializer=!p_for_ready && !p_func;
if (is_initializer || String(p_func->name)=="_init") {
if (is_initializer || (p_func && String(p_func->name)=="_init")) {
//parse initializer for class members
if (!p_func && p_class->extends_used && p_script->native.is_null()){

View File

@ -2081,6 +2081,8 @@ void GDParser::_parse_class(ClassNode *p_class) {
ClassNode *newclass = alloc_node<ClassNode>();
newclass->initializer = alloc_node<BlockNode>();
newclass->initializer->parent_class=newclass;
newclass->ready = alloc_node<BlockNode>();
newclass->ready->parent_class=newclass;
newclass->name=name;
newclass->owner=p_class;