Skip to content

Commit

Permalink
fix #6077
Browse files Browse the repository at this point in the history
  • Loading branch information
rtri committed Nov 12, 2018
1 parent fd0609f commit 4ed0b9e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions rts/System/Platform/WindowManagerHelper.cpp
Expand Up @@ -38,10 +38,7 @@ void SetIcon(CBitmap* bmp) {
}

// supplied bitmap is usable as icon, keep it
if (!SetIconSurface(globalRendering->GetWindow(0), bmp))
return;

windowIcon.bmp = std::move(*bmp);
SetIconSurface(globalRendering->GetWindow(0), bmp);
}


Expand All @@ -50,6 +47,9 @@ bool SetIconSurface(SDL_Window* win, CBitmap* bmp) {
// only reached on exit
SDL_FreeSurface(windowIcon.surf);
SDL_SetWindowIcon(win, windowIcon.surf = nullptr);

// do not rely on static deinit, pool might be destructed first
windowIcon.bmp = CBitmap{};
return false;
}

Expand All @@ -63,6 +63,8 @@ bool SetIconSurface(SDL_Window* win, CBitmap* bmp) {

SDL_FreeSurface(windowIcon.surf);
SDL_SetWindowIcon(win, windowIcon.surf = surf);

windowIcon.bmp = std::move(*bmp);
return true;
}

Expand Down

0 comments on commit 4ed0b9e

Please sign in to comment.