From 03fec8b74dbf78b8e8e8272bd63734391c4d5620 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 12 Mar 2021 20:36:38 +0100 Subject: [PATCH] Fixed an issue where a black screen would sometimes be shown when enabling collections. --- es-app/src/guis/GuiCollectionSystemsOptions.cpp | 2 ++ es-app/src/guis/GuiSettings.cpp | 9 ++++++--- es-app/src/guis/GuiSettings.h | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/es-app/src/guis/GuiCollectionSystemsOptions.cpp b/es-app/src/guis/GuiCollectionSystemsOptions.cpp index 6633c2ca8..e37004e09 100644 --- a/es-app/src/guis/GuiCollectionSystemsOptions.cpp +++ b/es-app/src/guis/GuiCollectionSystemsOptions.cpp @@ -84,6 +84,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions( setNeedsSaving(); setNeedsReloading(); setNeedsCollectionsUpdate(); + setDoNotInvalidateCachedBackground(); } }); @@ -137,6 +138,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions( setNeedsReloading(); setNeedsCollectionsUpdate(); setNeedsGoToGroupedCollections(); + setDoNotInvalidateCachedBackground(); } } }); diff --git a/es-app/src/guis/GuiSettings.cpp b/es-app/src/guis/GuiSettings.cpp index f6cdbf3a0..790fcb6b4 100644 --- a/es-app/src/guis/GuiSettings.cpp +++ b/es-app/src/guis/GuiSettings.cpp @@ -33,6 +33,7 @@ GuiSettings::GuiSettings( mNeedsGoToStart(false), mNeedsGoToSystem(false), mNeedsGoToGroupedCollections(false), + mDoNotInvalidateCachedBackground(false), mGoToSystem(nullptr) { addChild(&mMenu); @@ -134,9 +135,11 @@ void GuiSettings::save() } } - if (mNeedsSaving || mNeedsCollectionsUpdate || mNeedsReloading || mNeedsSorting || - mNeedsGoToStart || mNeedsGoToSystem) - mWindow->invalidateCachedBackground(); + if (!mDoNotInvalidateCachedBackground) { + if (mNeedsSaving || mNeedsCollectionsUpdate || mNeedsReloading || mNeedsSorting || + mNeedsGoToStart || mNeedsGoToSystem) + mWindow->invalidateCachedBackground(); + } } void GuiSettings::addEditableTextComponent( diff --git a/es-app/src/guis/GuiSettings.h b/es-app/src/guis/GuiSettings.h index fa36d995c..a378f9cc9 100644 --- a/es-app/src/guis/GuiSettings.h +++ b/es-app/src/guis/GuiSettings.h @@ -43,6 +43,7 @@ public: void setNeedsGoToSystem(SystemData* goToSystem) { mNeedsGoToSystem = true; mGoToSystem = goToSystem; }; void setNeedsGoToGroupedCollections() { mNeedsGoToGroupedCollections = true; }; + void setDoNotInvalidateCachedBackground() { mDoNotInvalidateCachedBackground = true; }; bool input(InputConfig* config, Input input) override; std::vector getHelpPrompts() override; @@ -60,6 +61,7 @@ private: bool mNeedsGoToStart; bool mNeedsGoToSystem; bool mNeedsGoToGroupedCollections; + bool mDoNotInvalidateCachedBackground; SystemData* mGoToSystem; };