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);
|
||||
}
|
||||
~Rule() { cscript::bcode_unref(func); }
|
||||
|
||||
void set_func(Uint32 *c) {
|
||||
func = c;
|
||||
cscript::bcode_ref(func);
|
||||
}
|
||||
};
|
||||
|
||||
Vector<Rule> rules;
|
||||
|
@ -448,10 +453,7 @@ struct ObState: CsState {
|
|||
Rule &r = rules.push();
|
||||
r.target = target;
|
||||
r.action = action;
|
||||
if (body) {
|
||||
r.func = body;
|
||||
cscript::bcode_ref(body);
|
||||
}
|
||||
r.set_func(body);
|
||||
r.deps = cscript::util::list_explode(dep);
|
||||
}
|
||||
}
|
||||
|
@ -465,9 +467,9 @@ struct ObState: CsState {
|
|||
if (!oldr)
|
||||
return;
|
||||
Rule &r = rules.push();
|
||||
r.set_func(oldr->func);
|
||||
r.target = tgt;
|
||||
r.action = oldr->action;
|
||||
r.func = oldr->func;
|
||||
r.deps = inherit_deps ? oldr->deps : cscript::util::list_explode(dep);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue