forked from OctaForge/OctaBuild
fix cubescript func refcount
parent
b217bbcd65
commit
cc1cfe1328
12
main.cc
12
main.cc
|
@ -246,6 +246,11 @@ struct ObState: CsState {
|
||||||
cscript::bcode_ref(func);
|
cscript::bcode_ref(func);
|
||||||
}
|
}
|
||||||
~Rule() { cscript::bcode_unref(func); }
|
~Rule() { cscript::bcode_unref(func); }
|
||||||
|
|
||||||
|
void set_func(Uint32 *c) {
|
||||||
|
func = c;
|
||||||
|
cscript::bcode_ref(func);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Vector<Rule> rules;
|
Vector<Rule> rules;
|
||||||
|
@ -448,10 +453,7 @@ struct ObState: CsState {
|
||||||
Rule &r = rules.push();
|
Rule &r = rules.push();
|
||||||
r.target = target;
|
r.target = target;
|
||||||
r.action = action;
|
r.action = action;
|
||||||
if (body) {
|
r.set_func(body);
|
||||||
r.func = body;
|
|
||||||
cscript::bcode_ref(body);
|
|
||||||
}
|
|
||||||
r.deps = cscript::util::list_explode(dep);
|
r.deps = cscript::util::list_explode(dep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -465,9 +467,9 @@ struct ObState: CsState {
|
||||||
if (!oldr)
|
if (!oldr)
|
||||||
return;
|
return;
|
||||||
Rule &r = rules.push();
|
Rule &r = rules.push();
|
||||||
|
r.set_func(oldr->func);
|
||||||
r.target = tgt;
|
r.target = tgt;
|
||||||
r.action = oldr->action;
|
r.action = oldr->action;
|
||||||
r.func = oldr->func;
|
|
||||||
r.deps = inherit_deps ? oldr->deps : cscript::util::list_explode(dep);
|
r.deps = inherit_deps ? oldr->deps : cscript::util::list_explode(dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue