From 1452c994fc4293a66c0530ac63acedcfc31cbe6c Mon Sep 17 00:00:00 2001 From: ASleepyCat Date: Tue, 27 Apr 2021 23:22:57 +1000 Subject: [PATCH] Fix assertion failing when exiting while a chart is loading --- Main/src/Game.cpp | 2 -- Main/src/Track.cpp | 6 +++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Main/src/Game.cpp b/Main/src/Game.cpp index 95f64cc93..4afc25419 100755 --- a/Main/src/Game.cpp +++ b/Main/src/Game.cpp @@ -209,8 +209,6 @@ class Game_Impl : public Game ~Game_Impl() { - if (m_track) - g_input.OnButtonReleased.Remove(m_track, &Track::OnButtonReleased); delete m_track; delete m_background; delete m_foreground; diff --git a/Main/src/Track.cpp b/Main/src/Track.cpp index 06720b2ab..a076c9fa3 100644 --- a/Main/src/Track.cpp +++ b/Main/src/Track.cpp @@ -24,7 +24,11 @@ Track::Track() Track::~Track() { - delete loader; + if (loader) + { + delete loader; + g_input.OnButtonReleased.Remove(this, &Track::OnButtonReleased); + } for (auto & i : m_laserTrackBuilder) delete i;