From 2607c3a96f39a8483d3b72b8018e162f7d581c64 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 6 May 2024 19:27:56 +0200 Subject: fix stale reference in editor::update() It also reduces the amount of Corrade asserts by calling `.data()` and `.get()` rather than `.operator[]` and `.operator*`. --- editor/update.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'editor') diff --git a/editor/update.cpp b/editor/update.cpp index 52c84d4d..204248c5 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -241,13 +241,12 @@ void app::update_world(Ns dt) auto size = (uint32_t)c.objects().size(); for (auto i = 0u; i < size; i++) { - auto& eʹ = c.objects().data()[i]; auto index = size_t{i}; - auto& e = *eʹ; + auto& e = *c.objects().data()[i].get(); if (e.last_frame_no == frame_no) [[unlikely]] continue; e.last_frame_no = frame_no; - e.update(eʹ, index, dt); // objects can't delete themselves during update() + e.update(c.objects().data()[i], index, dt); // objects can't delete themselves during update() if (&e.chunk() != cʹ || index > i) [[unlikely]] { i--; -- cgit v1.2.3