mirror of
https://github.com/reactos/reactos.git
synced 2025-06-19 22:45:20 +00:00
[RSHELL]
* CMenuBand: Refcount before assigning a return pointer. * CMenuDeskBar: Revert change and protect the refcounting in case I was wrong to assume there will be exactly one OnFinalMessage for each OnCreate. * CMenuToolbars: Add a debug message. * CStartMenu: Refcount correctly. svn path=/branches/shell-experiments/; revision=65088
This commit is contained in:
parent
6dce3d956e
commit
40a2e03359
7 changed files with 48 additions and 19 deletions
|
@ -628,21 +628,22 @@ HRESULT STDMETHODCALLTYPE CMenuBand::SetClient(IUnknown *punkClient)
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT hr = punkClient->QueryInterface(IID_PPV_ARG(IMenuPopup, &m_subMenuChild));
|
||||
|
||||
return hr;
|
||||
return punkClient->QueryInterface(IID_PPV_ARG(IMenuPopup, &m_subMenuChild));
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuBand::GetClient(IUnknown **ppunkClient)
|
||||
{
|
||||
// HACK, so I can test for a submenu in the DeskBar
|
||||
if (ppunkClient)
|
||||
if (!ppunkClient)
|
||||
return E_POINTER;
|
||||
*ppunkClient = NULL;
|
||||
|
||||
if (m_subMenuChild)
|
||||
{
|
||||
if (m_subMenuChild)
|
||||
*ppunkClient = m_subMenuChild;
|
||||
else
|
||||
*ppunkClient = NULL;
|
||||
m_subMenuChild->AddRef();
|
||||
*ppunkClient = m_subMenuChild;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,8 @@ CMenuDeskBar::CMenuDeskBar() :
|
|||
m_IconSize(0),
|
||||
m_Banner(NULL),
|
||||
m_Shown(FALSE),
|
||||
m_ShowFlags(0)
|
||||
m_ShowFlags(0),
|
||||
m_didAddRef(FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -49,7 +50,11 @@ CMenuDeskBar::~CMenuDeskBar()
|
|||
|
||||
LRESULT CMenuDeskBar::_OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
|
||||
{
|
||||
this->AddRef();
|
||||
if (!m_didAddRef)
|
||||
{
|
||||
this->AddRef();
|
||||
m_didAddRef = TRUE;
|
||||
}
|
||||
|
||||
bHandled = FALSE;
|
||||
return 0;
|
||||
|
@ -57,6 +62,11 @@ LRESULT CMenuDeskBar::_OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &b
|
|||
|
||||
void CMenuDeskBar::OnFinalMessage(HWND /* hWnd */)
|
||||
{
|
||||
if (m_didAddRef)
|
||||
{
|
||||
this->Release();
|
||||
m_didAddRef = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE CMenuDeskBar::Initialize(THIS)
|
||||
|
|
|
@ -50,6 +50,8 @@ private:
|
|||
BOOL m_Shown;
|
||||
DWORD m_ShowFlags;
|
||||
|
||||
BOOL m_didAddRef;
|
||||
|
||||
virtual void OnFinalMessage(HWND hWnd);
|
||||
public:
|
||||
CMenuDeskBar();
|
||||
|
|
|
@ -1374,6 +1374,7 @@ HRESULT CMenuSFToolbar::GetShellFolder(DWORD *pdwFlags, LPITEMIDLIST *ppidl, REF
|
|||
pidl = ILClone(m_idList);
|
||||
if (!pidl)
|
||||
{
|
||||
ERR("ILClone failed!\n");
|
||||
(*reinterpret_cast<IUnknown**>(ppv))->Release();
|
||||
return E_FAIL;
|
||||
}
|
||||
|
|
|
@ -262,16 +262,13 @@ public:
|
|||
IBandSite* pBandSite,
|
||||
IDeskBar* pDeskBar)
|
||||
{
|
||||
m_pShellMenu.Attach(pShellMenu);
|
||||
m_pBandSite.Attach(pBandSite);
|
||||
m_pDeskBar.Attach(pDeskBar);
|
||||
m_pShellMenu = pShellMenu;
|
||||
m_pBandSite = pBandSite;
|
||||
m_pDeskBar = pDeskBar;
|
||||
}
|
||||
|
||||
~CShellMenuCallback()
|
||||
{
|
||||
m_pShellMenu.Release();
|
||||
m_pBandSite.Release();
|
||||
m_pDeskBar.Release();
|
||||
}
|
||||
|
||||
HRESULT _SetProgramsFolder(IShellFolder * psf, LPITEMIDLIST pidl)
|
||||
|
|
|
@ -38,9 +38,9 @@
|
|||
#define COBJMACROS
|
||||
|
||||
//#define DEBUG_CCOMOBJECT
|
||||
//#define DEBUG_CCOMOBJECT_CREATION 1
|
||||
//#define DEBUG_CCOMOBJECT_DESTRUCTION 1
|
||||
//#define DEBUG_CCOMOBJECT_REFCOUNTING 0
|
||||
#define DEBUG_CCOMOBJECT_CREATION 1
|
||||
#define DEBUG_CCOMOBJECT_DESTRUCTION 1
|
||||
#define DEBUG_CCOMOBJECT_REFCOUNTING 1
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
|
|
|
@ -730,6 +730,24 @@ void ReleaseCComPtrExpectZero(CComPtr<T>& cptr, BOOL forceRelease = FALSE)
|
|||
}
|
||||
}
|
||||
|
||||
template<class T, class R>
|
||||
HRESULT inline ShellDebugObjectCreator(REFIID riid, R ** ppv)
|
||||
{
|
||||
CComPtr<T> obj;
|
||||
HRESULT hResult;
|
||||
|
||||
if (ppv == NULL)
|
||||
return E_POINTER;
|
||||
*ppv = NULL;
|
||||
ATLTRY(obj = new CComDebugObject<T>);
|
||||
if (obj.p == NULL)
|
||||
return E_OUTOFMEMORY;
|
||||
hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(ppv));
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
template<class T, class R>
|
||||
HRESULT inline ShellObjectCreator(REFIID riid, R ** ppv)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue