Skip to content

Commit

Permalink
Lock cacheLock when switching to last custom theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Windows10CE committed Jul 30, 2021
1 parent 60db1da commit a7427ff
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions PathfinderAPI/BaseGameFixes/Performance/ThemeCaching.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,18 @@ internal static bool SwitchToLastCustomTheme(object osObject, OSTheme theme)
{
if (theme == OSTheme.Custom)
{
// just dont question it
var lastTheme = CachedThemes.BackingListHead?.Value;
if (lastTheme != null)
lock (cacheLock)
{
if (!lastTheme.Loaded)
lastTheme.Load(true);
lastTheme.ApplyTo((OS)osObject);
// just dont question it
var lastTheme = CachedThemes.BackingListHead?.Value;
if (lastTheme != null)
{
if (!lastTheme.Loaded)
lastTheme.Load(true);
lastTheme.ApplyTo((OS) osObject);
}
}

return false;
}

Expand Down

0 comments on commit a7427ff

Please sign in to comment.