From 532c187d83153bb21540dc505f5478b80ce350f7 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Mon, 3 Jun 2024 11:23:48 -0400 Subject: [PATCH] Set event receiver to null before the receiver object is deleted * backported https://github.com/MultiCraft/MultiCraft/commit/bbcee42264d52bbd1662c88a9a3c31efd434a1d1 --- src/client/clientlauncher.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp index d40fc3c34..2b76d2fe5 100644 --- a/src/client/clientlauncher.cpp +++ b/src/client/clientlauncher.cpp @@ -70,6 +70,11 @@ static void dump_start_data(const GameStartData &data) ClientLauncher::~ClientLauncher() { + RenderingEngine *rendering_engine = RenderingEngine::get_instance(); + + if (rendering_engine && rendering_engine->get_raw_device()) + rendering_engine->get_raw_device()->setEventReceiver(nullptr); + delete receiver; delete input; @@ -77,7 +82,7 @@ ClientLauncher::~ClientLauncher() delete g_fontengine; delete g_gamecallback; - delete RenderingEngine::get_instance(); + delete rendering_engine; #if USE_SOUND deleteSoundManagerSingleton(g_sound_manager_singleton);