Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UndoRedo method call argument count after #58929 #58950

Merged
merged 1 commit into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions core/object/undo_redo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,18 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) {

switch (op.type) {
case Operation::TYPE_METHOD: {
int argc = op.args.size();
Vector<const Variant *> argptrs;
argptrs.resize(op.args.size());
int argc = 0;
argptrs.resize(argc);

for (int i = 0; i < op.args.size(); i++) {
for (int i = 0; i < argc; i++) {
argptrs.write[i] = &op.args[i];
}

Callable::CallError ce;
obj->callp(op.name, (const Variant **)argptrs.ptr(), argc, ce);
if (ce.error != Callable::CallError::CALL_OK) {
ERR_PRINT("Error calling method from signal '" + String(op.name) + "': " + Variant::get_call_error_text(obj, op.name, (const Variant **)argptrs.ptr(), argc, ce));
ERR_PRINT("Error calling UndoRedo method operation '" + String(op.name) + "': " + Variant::get_call_error_text(obj, op.name, (const Variant **)argptrs.ptr(), argc, ce));
}
#ifdef TOOLS_ENABLED
Resource *res = Object::cast_to<Resource>(obj);
Expand All @@ -334,7 +334,7 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) {
#endif

if (method_callback) {
method_callback(method_callbck_ud, obj, op.name, (const Variant **)argptrs.ptr(), argc);
method_callback(method_callback_ud, obj, op.name, (const Variant **)argptrs.ptr(), argc);
}
} break;
case Operation::TYPE_PROPERTY: {
Expand Down Expand Up @@ -432,7 +432,7 @@ void UndoRedo::set_commit_notify_callback(CommitNotifyCallback p_callback, void

void UndoRedo::set_method_notify_callback(MethodNotifyCallback p_method_callback, void *p_ud) {
method_callback = p_method_callback;
method_callbck_ud = p_ud;
method_callback_ud = p_ud;
}

void UndoRedo::set_property_notify_callback(PropertyNotifyCallback p_property_callback, void *p_ud) {
Expand Down
2 changes: 1 addition & 1 deletion core/object/undo_redo.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class UndoRedo : public Object {

CommitNotifyCallback callback = nullptr;
void *callback_ud = nullptr;
void *method_callbck_ud = nullptr;
void *method_callback_ud = nullptr;
void *prop_callback_ud = nullptr;

MethodNotifyCallback method_callback = nullptr;
Expand Down