Hack to fix some missing theme elements when invalidating the cached background.

This commit is contained in:
Leon Styhre 2021-03-21 16:41:24 +01:00
parent 980a23d083
commit 4b0f505b01
2 changed files with 12 additions and 4 deletions

View file

@ -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.

View file

@ -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();