From 4b0f505b01ecdab7a0cbd66650f430ba93dd5ebe Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 21 Mar 2021 16:41:24 +0100 Subject: [PATCH] Hack to fix some missing theme elements when invalidating the cached background. --- es-app/src/guis/GuiGamelistOptions.cpp | 10 ++++++---- es-app/src/guis/GuiSettings.cpp | 6 ++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/es-app/src/guis/GuiGamelistOptions.cpp b/es-app/src/guis/GuiGamelistOptions.cpp index 006f24dd9..2db9b5d2a 100644 --- a/es-app/src/guis/GuiGamelistOptions.cpp +++ b/es-app/src/guis/GuiGamelistOptions.cpp @@ -371,10 +371,12 @@ void GuiGamelistOptions::openMetaDataEd() CollectionSystemsManager::get()->refreshCollectionSystems(file, true); file->getSystem()->sortSystem(); - // This small delay keeps the theme extras from sometimes not being rendered while - // the background cache is invalidated. Very strange, it must be some kind of race - // condition or similar. - SDL_Delay(10); + // This delay reduces the likelyhood that the SVG rasterizer which is running in a + // separate thread is not done until the cached background is invalidated. Without + // this delay there's a high chance that some theme elements are not rendered in + // time and thus not getting included in the regenerated cached background. + // This is just a hack though and a better mechanism is needed to handle this. + SDL_Delay(100); mWindow->invalidateCachedBackground(); // Remove the folder entry from the gamelist.xml file. diff --git a/es-app/src/guis/GuiSettings.cpp b/es-app/src/guis/GuiSettings.cpp index 790fcb6b4..a19c2380c 100644 --- a/es-app/src/guis/GuiSettings.cpp +++ b/es-app/src/guis/GuiSettings.cpp @@ -136,6 +136,12 @@ void GuiSettings::save() } if (!mDoNotInvalidateCachedBackground) { + // This delay reduces the likelyhood that the SVG rasterizer which is running in a + // separate thread is not done until the cached background is invalidated. Without + // this delay there's a high chance that some theme elements are not rendered in + // time and thus not getting included in the regenerated cached background. + // This is just a hack though and a better mechanism is needed to handle this. + SDL_Delay(100); if (mNeedsSaving || mNeedsCollectionsUpdate || mNeedsReloading || mNeedsSorting || mNeedsGoToStart || mNeedsGoToSystem) mWindow->invalidateCachedBackground();