Author: tfaber
Date: Wed Aug 19 11:45:21 2015
New Revision: 68767
URL:
http://svn.reactos.org/svn/reactos?rev=68767&view=rev
Log:
[SHELL32]
- Correctly handle NULL callback in CMenuBand::GetMenuInfo
- Add missing error handling in CMenuFocusManager::UpdateFocus
Fixes crashes in shell32_apitest:menu
CORE-9932 #resolve
Modified:
trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp
trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp
Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuBand.cpp [iso-8859-1] Wed Aug 19
11:45:21 2015
@@ -108,7 +108,8 @@
if (ppsmc)
{
- m_psmc->AddRef();
+ if (m_psmc)
+ m_psmc->AddRef();
*ppsmc = m_psmc;
}
Modified: trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shellmen…
==============================================================================
--- trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp [iso-8859-1]
(original)
+++ trunk/reactos/dll/win32/shell32/shellmenu/CMenuFocusManager.cpp [iso-8859-1] Wed Aug
19 11:45:21 2015
@@ -814,14 +814,22 @@
CComPtr<IServiceProvider> bandSite;
CComPtr<IOleWindow> deskBar;
hr = topMenu->mb->GetSite(IID_PPV_ARG(IServiceProvider,
&bandSite));
+ if (FAILED(hr))
+ goto NoCapture;
hr = bandSite->QueryService(SID_SMenuPopup, IID_PPV_ARG(IOleWindow,
&deskBar));
+ if (FAILED(hr))
+ goto NoCapture;
CComPtr<IOleWindow> deskBarSite;
hr = IUnknown_GetSite(deskBar, IID_PPV_ARG(IOleWindow, &deskBarSite));
+ if (FAILED(hr))
+ goto NoCapture;
// FIXME: Find the correct place for this
HWND hWndOwner;
- deskBarSite->GetWindow(&hWndOwner);
+ hr = deskBarSite->GetWindow(&hWndOwner);
+ if (FAILED(hr))
+ goto NoCapture;
m_PreviousForeground = ::GetForegroundWindow();
if (m_PreviousForeground != hWndOwner)
@@ -832,9 +840,11 @@
// Get the HWND of the top-level window
HWND hWndSite;
hr = deskBar->GetWindow(&hWndSite);
+ if (FAILED(hr))
+ goto NoCapture;
SetMenuCapture(hWndSite);
-
- }
+ }
+NoCapture:
if (!m_parent || m_parent->type == MenuBarEntry)
{