From 8ab9ca3d2cdcc1714a2eb7e1b3c54744cf78ee88 Mon Sep 17 00:00:00 2001 From: sluicebox <22204938+sluicebox@users.noreply.github.com> Date: Fri, 3 Mar 2023 21:48:17 -0800 Subject: [PATCH] WIN32: Fix CoInitialize / CoUninitialize imbalance On Vista and earlier, Win32TaskbarManager called CoUninitialize without calling CoInitialize --- backends/taskbar/win32/win32-taskbar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/taskbar/win32/win32-taskbar.cpp b/backends/taskbar/win32/win32-taskbar.cpp index ad2f1891bdf..1d147343179 100644 --- a/backends/taskbar/win32/win32-taskbar.cpp +++ b/backends/taskbar/win32/win32-taskbar.cpp @@ -74,12 +74,12 @@ const PROPERTYKEY PKEY_Title = { /* fmtid = */ { 0xF29F85E0, 0x4FF9, 0x1068, { 0xAB, 0x91, 0x08, 0x00, 0x2B, 0x27, 0xB3, 0xD9 } }, /* propID = */ 2 }; Win32TaskbarManager::Win32TaskbarManager(SdlWindow_Win32 *window) : _window(window), _taskbar(nullptr), _count(0), _icon(nullptr) { + CoInitialize(nullptr); + // Do nothing if not running on Windows 7 or later if (!Win32::confirmWindowsVersion(6, 1)) return; - CoInitialize(nullptr); - // Try creating instance (on fail, _taskbar will contain NULL) HRESULT hr = CoCreateInstance(CLSID_TaskbarList, nullptr,