From dd04895571894674e356cce1cab259758e9a87f2 Mon Sep 17 00:00:00 2001 From: Rob Mensching <rob@firegiant.com> Date: Mon, 12 Apr 2021 10:55:43 -0700 Subject: Release taskbar before COM uninitialized to prevent crash Fixes wixtoolset/issues#5966 --- src/wixstdba/WixStandardBootstrapperApplication.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/wixstdba/WixStandardBootstrapperApplication.cpp b/src/wixstdba/WixStandardBootstrapperApplication.cpp index 0fcf3a21..f690c1a6 100644 --- a/src/wixstdba/WixStandardBootstrapperApplication.cpp +++ b/src/wixstdba/WixStandardBootstrapperApplication.cpp @@ -1894,6 +1894,7 @@ private: // privates LExit: // destroy main window pThis->DestroyMainWindow(); + pThis->UninitializeTaskbarButton(); // initiate engine shutdown DWORD dwQuit = HRESULT_CODE(hr); @@ -2556,6 +2557,17 @@ private: // privates } } + + // + // UninitializeTaskbarButton - clean up the taskbar registration. + // + void UninitializeTaskbarButton() + { + m_fTaskbarButtonOK = FALSE; + ReleaseNullObject(m_pTaskbarList); + } + + static LRESULT CallDefaultWndProc( __in CWixStandardBootstrapperApplication* pBA, __in HWND hWnd, @@ -3857,6 +3869,7 @@ public: ~CWixStandardBootstrapperApplication() { AssertSz(!::IsWindow(m_hWnd), "Window should have been destroyed before destructor."); + AssertSz(!m_pTaskbarList, "Taskbar should have been released before destructor."); AssertSz(!m_pTheme, "Theme should have been released before destructor."); for (DWORD i = 0; i < m_Bundle.packages.cPackages; ++i) @@ -3865,7 +3878,6 @@ public: } ::DeleteCriticalSection(&m_csShowingInternalUiThisPackage); - ReleaseObject(m_pTaskbarList); ReleaseDict(m_sdOverridableVariables); ReleaseStr(m_sczFailedMessage); ReleaseStr(m_sczConfirmCloseMessage); -- cgit v1.2.3-55-g6feb