diff --git a/es-core/src/components/GameSelectorComponent.h b/es-core/src/components/GameSelectorComponent.h index c828fdf17..8a7f7a2c0 100644 --- a/es-core/src/components/GameSelectorComponent.h +++ b/es-core/src/components/GameSelectorComponent.h @@ -25,6 +25,13 @@ public: mSystem->getRootFolder()->setUpdateListCallback([&]() { mNeedsRefresh = true; }); } + ~GameSelectorComponent() + { + if (std::find(SystemData::sSystemVector.cbegin(), SystemData::sSystemVector.cend(), + mSystem) != SystemData::sSystemVector.cend()) + mSystem->getRootFolder()->setUpdateListCallback(nullptr); + } + enum class GameSelection { RANDOM, // Replace with AllowShortEnumsOnASingleLine: false (clang-format >=11.0). LAST_PLAYED,