Fixed a use-after-free in GameSelectorComponent.

This commit is contained in:
Leon Styhre 2022-02-20 19:31:19 +01:00
parent 46eec8ead6
commit c7a4449e36

View file

@ -25,6 +25,13 @@ public:
mSystem->getRootFolder()->setUpdateListCallback([&]() { mNeedsRefresh = true; }); 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 { enum class GameSelection {
RANDOM, // Replace with AllowShortEnumsOnASingleLine: false (clang-format >=11.0). RANDOM, // Replace with AllowShortEnumsOnASingleLine: false (clang-format >=11.0).
LAST_PLAYED, LAST_PLAYED,