diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-03-09 22:59:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-09 22:59:54 +0100 |
commit | 450ebaab9f333ca463e6e57a29fdc2e47c227c36 (patch) | |
tree | f74c5ba20cc919f60da2ac4c96954f77812e4faf /core/object | |
parent | 97cb90aa3a35112772d8f4427f4c383605ea467c (diff) | |
parent | b85e5d51b2f1a88780a5b59fc18a2eb3059d4b96 (diff) |
Merge pull request #58950 from akien-mga/fix-undoredo-argcount
Diffstat (limited to 'core/object')
-rw-r--r-- | core/object/undo_redo.cpp | 12 | ||||
-rw-r--r-- | core/object/undo_redo.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/core/object/undo_redo.cpp b/core/object/undo_redo.cpp index f7a12a7528..ee8eb97a93 100644 --- a/core/object/undo_redo.cpp +++ b/core/object/undo_redo.cpp @@ -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); @@ -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: { @@ -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) { diff --git a/core/object/undo_redo.h b/core/object/undo_redo.h index 8871a549f8..ecd7a21167 100644 --- a/core/object/undo_redo.h +++ b/core/object/undo_redo.h @@ -92,7 +92,7 @@ private: 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; |