Author: dquintana
Date: Tue Oct 28 01:27:02 2014
New Revision: 65065
URL:
http://svn.reactos.org/svn/reactos?rev=65065&view=rev
Log:
[RSHELL]
* Fix some small things that were getting in the way of fixing the start menu (which was
broken and no one noticed). The actual fix will come tomorrow since my brain is about to
implode at this time.
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
branches/shell-experiments/base/shell/rshell/precomp.h
branches/shell-experiments/include/reactos/undocshell.h
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Tue Oct 28
01:27:02 2014
@@ -909,6 +909,7 @@
HRESULT CMenuBand::_MenuItemHotTrack(DWORD changeType)
{
+ CComPtr<CMenuBand> safeThis = this;
HRESULT hr;
if (m_dwFlags & SMINIT_VERTICAL)
@@ -951,6 +952,7 @@
{
m_subMenuParent->OnSelect(changeType);
}
+ TRACE("Menu closed, executing item...\n");
m_hotBar->ExecuteItem(m_hotItem);
break;
Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] Tue Oct 28
01:27:02 2014
@@ -131,11 +131,15 @@
HRESULT STDMETHODCALLTYPE CMenuDeskBar::QueryService(REFGUID guidService, REFIID riid,
void **ppvObject)
{
+ HRESULT hr;
+
if (IsEqualGUID(guidService, SID_SMenuPopup) ||
IsEqualGUID(guidService, SID_SMenuBandParent) ||
IsEqualGUID(guidService, SID_STopLevelBrowser))
{
- return this->QueryInterface(riid, ppvObject);
+ hr = this->QueryInterface(riid, ppvObject);
+ if (SUCCEEDED(hr))
+ return hr;
}
if (IsEqualGUID(guidService, SID_SMenuBandBottom) ||
@@ -145,7 +149,9 @@
if (m_Client == NULL)
return E_NOINTERFACE;
- return IUnknown_QueryService(m_Client, guidService, riid, ppvObject);
+ hr = IUnknown_QueryService(m_Client, guidService, riid, ppvObject);
+ if (SUCCEEDED(hr))
+ return hr;
}
@@ -484,6 +490,8 @@
*
*/
+ CComPtr<IMenuPopup> oldParent = m_SubMenuParent;
+
switch (dwSelectType)
{
case MPOS_EXECUTE:
@@ -498,8 +506,8 @@
case MPOS_SELECTLEFT:
case MPOS_SELECTRIGHT:
case MPOS_CHILDTRACKING:
- if (m_SubMenuParent)
- return m_SubMenuParent->OnSelect(dwSelectType);
+ if (oldParent)
+ return oldParent->OnSelect(dwSelectType);
break;
}
Modified: branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1] Tue
Oct 28 01:27:02 2014
@@ -832,6 +832,11 @@
DbgPrint("PopMenuBar %p\n", mb);
+ if (m_current == m_entryUnderMouse)
+ {
+ m_entryUnderMouse = NULL;
+ }
+
hr = PopFromArray(&type, &mbc, NULL);
if (FAILED_UNEXPECTEDLY(hr))
{
@@ -871,6 +876,11 @@
DbgPrint("PopMenuPopup %p\n", mb);
+ if (m_current == m_entryUnderMouse)
+ {
+ m_entryUnderMouse = NULL;
+ }
+
hr = PopFromArray(&type, &mbc, NULL);
if (FAILED_UNEXPECTEDLY(hr))
{
Modified: branches/shell-experiments/base/shell/rshell/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/precomp.h [iso-8859-1] Tue Oct 28
01:27:02 2014
@@ -37,6 +37,11 @@
#define COBJMACROS
+//#define DEBUG_CCOMOBJECT
+//#define DEBUG_CCOMOBJECT_CREATION 1
+//#define DEBUG_CCOMOBJECT_DESTRUCTION 1
+//#define DEBUG_CCOMOBJECT_REFCOUNTING 0
+
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
Modified: branches/shell-experiments/include/reactos/undocshell.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/include/react…
==============================================================================
--- branches/shell-experiments/include/reactos/undocshell.h [iso-8859-1] (original)
+++ branches/shell-experiments/include/reactos/undocshell.h [iso-8859-1] Tue Oct 28
01:27:02 2014
@@ -626,6 +626,9 @@
public:
CComDebugObject(void * = NULL)
{
+#if DEBUG_CCOMOBJECT_CREATION
+ DbgPrint("%S, this=%08p\n", __FUNCTION__,
static_cast<Base*>(this));
+#endif
_pAtlModule->Lock();
}
@@ -638,25 +641,28 @@
STDMETHOD_(ULONG, AddRef)()
{
int rc = this->InternalAddRef();
- DbgPrint("RefCount is now %d(++)! %s\n", rc, __FUNCTION__);
+#if DEBUG_CCOMOBJECT_REFCOUNTING
+ DbgPrint("%s, RefCount is now %d(--)! \n", __FUNCTION__, rc);
+#endif
return rc;
}
STDMETHOD_(ULONG, Release)()
{
- ULONG newRefCount;
-
- newRefCount = this->InternalRelease();
- if (newRefCount == 0)
+ int rc = this->InternalRelease();
+
+#if DEBUG_CCOMOBJECT_REFCOUNTING
+ DbgPrint("%s, RefCount is now %d(--)! \n", __FUNCTION__, rc);
+#endif
+
+ if (rc == 0)
{
- DbgPrint("RefCount is now 0! Deleting! %s\n", newRefCount,
__FUNCTION__);
+#if DEBUG_CCOMOBJECT_DESTRUCTION
+ DbgPrint("%s, RefCount reached 0 Deleting!\n", __FUNCTION__);
+#endif
delete this;
}
- else
- {
- DbgPrint("RefCount is now %d(--)! %s\n", newRefCount,
__FUNCTION__);
- }
- return newRefCount;
+ return rc;
}
STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject)
@@ -675,9 +681,9 @@
hResult = E_OUTOFMEMORY;
newInstance = NULL;
- ATLTRY(newInstance = new CComDebugObject<Base>())
- if (newInstance != NULL)
- {
+ ATLTRY(newInstance = new CComDebugObject<Base>());
+ if (newInstance != NULL)
+ {
newInstance->SetVoid(NULL);
newInstance->InternalFinalConstructAddRef();
hResult = newInstance->_AtlInitialConstruct();
@@ -691,7 +697,7 @@
delete newInstance;
newInstance = NULL;
}
- }
+ }
*pp = newInstance;
return hResult;
}