Merge pull request #59659 from fountainment/fix_callable_bind_usage

Fix Callable::bind usage in connections_dialog.h and packed_scene.cpp
This commit is contained in:
Rémi Verschelde 2022-03-30 09:00:07 +02:00 committed by GitHub
commit f6ef63635f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 4 deletions

View file

@ -93,8 +93,11 @@ public:
if (unbinds > 0) {
return Callable(target, method).unbind(unbinds);
} else if (!binds.is_empty()) {
const Variant *args = binds.ptr();
return Callable(target, method).bind(&args, binds.size());
const Variant **argptrs = (const Variant **)alloca(sizeof(Variant *) * binds.size());
for (int i = 0; i < binds.size(); i++) {
argptrs[i] = &binds[i];
}
return Callable(target, method).bind(argptrs, binds.size());
} else {
return Callable(target, method);
}

View file

@ -362,8 +362,11 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const {
}
}
const Variant *args = binds.ptr();
callable = callable.bind(&args, binds.size());
const Variant **argptrs = (const Variant **)alloca(sizeof(Variant *) * binds.size());
for (int j = 0; j < binds.size(); j++) {
argptrs[j] = &binds[j];
}
callable = callable.bind(argptrs, binds.size());
}
cfrom->connect(snames[c.signal], callable, varray(), CONNECT_PERSIST | c.flags);