diff options
author | fuzzy@home <70929713+komugi1211s@users.noreply.github.com> | 2023-04-28 22:00:24 +0900 |
---|---|---|
committer | fuzzy@home <70929713+komugi1211s@users.noreply.github.com> | 2023-06-18 22:32:23 +0900 |
commit | 09fa22002a843369e070eeedb590bbb51eb82bb7 (patch) | |
tree | 52e31c9588c8d63957fb549b84adc04af77448db /core/object | |
parent | a83eb16fba5bb3da086b41cbd79e6f95b09eb8ee (diff) | |
download | redot-engine-09fa22002a843369e070eeedb590bbb51eb82bb7.tar.gz |
fixes #76473, where filling a large amount of tiles all at once crashes
the engine due to segmentation fault.
Diffstat (limited to 'core/object')
-rw-r--r-- | core/object/undo_redo.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/object/undo_redo.cpp b/core/object/undo_redo.cpp index 17d9eaff0b..f04961c760 100644 --- a/core/object/undo_redo.cpp +++ b/core/object/undo_redo.cpp @@ -312,6 +312,11 @@ void UndoRedo::commit_action(bool p_execute) { } void UndoRedo::_process_operation_list(List<Operation>::Element *E) { + const int PREALLOCATE_ARGS_COUNT = 16; + + LocalVector<const Variant *> args; + args.reserve(PREALLOCATE_ARGS_COUNT); + for (; E; E = E->next()) { Operation &op = E->get(); @@ -347,12 +352,13 @@ void UndoRedo::_process_operation_list(List<Operation>::Element *E) { if (binds.is_empty()) { method_callback(method_callback_ud, obj, op.name, nullptr, 0); } else { - const Variant **args = (const Variant **)alloca(sizeof(const Variant **) * binds.size()); + args.clear(); + for (int i = 0; i < binds.size(); i++) { - args[i] = (const Variant *)&binds[i]; + args.push_back(&binds[i]); } - method_callback(method_callback_ud, obj, op.name, args, binds.size()); + method_callback(method_callback_ud, obj, op.name, args.ptr(), binds.size()); } } } break; |