From bd6400ca442b1ee2d4deb6fede68c00e70999d9e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 9 Aug 2024 09:48:11 +0200 Subject: editor: now use bptr::destroy() --- editor/scenery-editor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'editor/scenery-editor.cpp') diff --git a/editor/scenery-editor.cpp b/editor/scenery-editor.cpp index 778a0275..4de14207 100644 --- a/editor/scenery-editor.cpp +++ b/editor/scenery-editor.cpp @@ -93,12 +93,14 @@ start: while (auto id = a.get_object_colliding_with_cursor()) { for (auto i = 0uz; i < sz; i++) - if (const auto eʹ = es[i]; eʹ->id == id) + if (auto eʹ = es[i]; eʹ->id == id) { - eʹ->destroy_script_pre(eʹ, script_destroy_reason::kill); + auto& e = *eʹ; + e.destroy_script_pre(eʹ, script_destroy_reason::kill); c.remove_object(i); - eʹ->destroy_script_post(); - eʹ->gone = true; + e.destroy_script_post(); + e.gone = true; + eʹ.destroy(); goto start; } break; -- cgit v1.2.3