From 9c6fadb828110d72dc92d4a5b4c1bc4b17e8adfc Mon Sep 17 00:00:00 2001 From: ge0rdi Date: Fri, 6 Jul 2018 00:50:50 +0200 Subject: [PATCH] Fix for recent Windows Insider builds (#11) (#33) CMenuContainer object was not destroyed when Start Menu window was closed. It was referenced by IFrameworkInputPane::AdviseWithHWND call (to be able to receive input pane notifications). The problem was that dereferencing (IFrameworkInputPane::Unadvise) was called from CMenuContainer destructor that is called only when object's refcount goes to zero. In previous Windows versions it somehow worked, because for some reason CMenuContainer object was no longer referenced when its window was destroyed. Apparently there was some change in IFrameworkInputPane handling in recent Windows builds (starting with 17692). To fix the issue we have to call IFrameworkInputPane::Unadvise() when CMenuContainer's window is about to be destroyed. --- .../ClassicStartMenu/ClassicStartMenuDLL/MenuContainer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ClassicStartSrc/ClassicStartMenu/ClassicStartMenuDLL/MenuContainer.cpp b/ClassicStartSrc/ClassicStartMenu/ClassicStartMenuDLL/MenuContainer.cpp index aa527b1..4a2733a 100644 --- a/ClassicStartSrc/ClassicStartMenu/ClassicStartMenuDLL/MenuContainer.cpp +++ b/ClassicStartSrc/ClassicStartMenu/ClassicStartMenuDLL/MenuContainer.cpp @@ -770,9 +770,6 @@ CMenuContainer::~CMenuContainer( void ) if (m_SearchIcons) DeleteObject(m_SearchIcons); if (m_pProgramsTree) m_pProgramsTree->Release(); - - if (s_pFrameworkInputPane && m_InputCookie) - s_pFrameworkInputPane->Unadvise(m_InputCookie); } void CMenuContainer::AddFirstFolder( IShellItem *pFolder, std::vector &items, int options ) @@ -6215,6 +6212,10 @@ LRESULT CMenuContainer::OnDestroy( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL CloseThemeData(m_ScrollTheme); m_ScrollTheme=NULL; } + + if (s_pFrameworkInputPane && m_InputCookie) + s_pFrameworkInputPane->Unadvise(m_InputCookie); + return 0; }