Fixed crash at shutdown on Windows

The taskbar list is invalid after OleUninitialize(), so make sure we clean it up first.

Also don't bother creating the taskbar list if we don't have any progress state
This commit is contained in:
Sam Lantinga
2025-04-01 14:54:53 -07:00
parent e87a00c07c
commit c3ce216c4d
2 changed files with 10 additions and 6 deletions

View File

@@ -583,12 +583,6 @@ void WIN_VideoQuit(SDL_VideoDevice *_this)
WIN_QuitKeyboard(_this);
WIN_QuitMouse(_this);
if (data->oleinitialized) {
OleUninitialize();
data->oleinitialized = false;
}
#endif // !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES))
#if defined(HAVE_SHOBJIDL_CORE_H)
if (data->taskbar_list) {
IUnknown_Release(data->taskbar_list);
@@ -596,6 +590,12 @@ void WIN_VideoQuit(SDL_VideoDevice *_this)
}
#endif
if (data->oleinitialized) {
OleUninitialize();
data->oleinitialized = false;
}
#endif // !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES))
if (data->coinitialized) {
WIN_CoUninitialize();
data->coinitialized = false;

View File

@@ -2253,6 +2253,10 @@ bool WIN_ApplyWindowProgress(SDL_VideoDevice *_this, SDL_Window* window)
return true;
}
if (window->progress_state == SDL_PROGRESS_STATE_NONE && !data->videodata->taskbar_list) {
return true;
}
ITaskbarList3 *taskbar_list = GetTaskbarList(window);
if (!taskbar_list) {
return false;