Author: dquintana
Date: Wed Jun 4 16:25:48 2014
New Revision: 63539
URL:
http://svn.reactos.org/svn/reactos?rev=63539&view=rev
Log:
[SHELL32]
* Fix gcc compilation.
[BROWSEUI/RSHELL]
* Use virtual destructors and cleanup with delete in the creator functions.
* Try to fix a bit the "close" flow, so that less circular references remain
when the filebrowser windows are closed.
Modified:
branches/shell-experiments/base/shell/rshell/CMenuBand.cpp
branches/shell-experiments/base/shell/rshell/CMenuBand.h
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp
branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h
branches/shell-experiments/base/shell/rshell/CMenuSite.cpp
branches/shell-experiments/base/shell/rshell/CMenuSite.h
branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp
branches/shell-experiments/base/shell/rshell/CMergedFolder.h
branches/shell-experiments/dll/win32/browseui/addressband.cpp
branches/shell-experiments/dll/win32/browseui/addressband.h
branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp
branches/shell-experiments/dll/win32/browseui/internettoolbar.h
branches/shell-experiments/dll/win32/browseui/precomp.h
branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
branches/shell-experiments/dll/win32/browseui/toolsband.cpp
branches/shell-experiments/dll/win32/shell32/shlview.cpp
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] Wed Jun 4
16:25:48 2014
@@ -52,7 +52,7 @@
hr = site->QueryInterface(riid, ppv);
if (FAILED_UNEXPECTEDLY(hr))
- site->Release();
+ delete site;
#endif
return hr;
@@ -255,14 +255,15 @@
return m_site->QueryInterface(riid, ppvSite);
}
-HRESULT STDMETHODCALLTYPE CMenuBand::GetWindow(
- HWND *phwnd)
+HRESULT STDMETHODCALLTYPE CMenuBand::GetWindow(HWND *phwnd)
{
if (m_SFToolbar != NULL)
return m_SFToolbar->GetWindow(phwnd);
if (m_staticToolbar != NULL)
return m_staticToolbar->GetWindow(phwnd);
+
+ if (phwnd) *phwnd = NULL;
return E_FAIL;
}
@@ -417,10 +418,25 @@
ShowDW(FALSE);
if (m_staticToolbar != NULL)
- return m_staticToolbar->Close();
+ {
+ m_staticToolbar->Close();
+ delete m_staticToolbar;
+ m_staticToolbar = NULL;
+ }
if (m_SFToolbar != NULL)
- return m_SFToolbar->Close();
+ {
+ m_SFToolbar->Close();
+ delete m_staticToolbar;
+ m_staticToolbar = NULL;
+ }
+
+ if (m_site) m_site.Release();
+ if (m_psmc) m_psmc.Release();
+ if (m_subMenuChild) m_subMenuChild.Release();
+ if (m_subMenuParent) m_subMenuParent.Release();
+ if (m_childBand) m_childBand.Release();
+ if (m_parentBand) m_parentBand.Release();
return S_OK;
}
Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuBand.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuBand.h [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -69,7 +69,7 @@
public:
CMenuBand();
- ~CMenuBand();
+ virtual ~CMenuBand();
DECLARE_NOT_AGGREGATABLE(CMenuBand)
DECLARE_PROTECT_FINAL_CONSTRUCT()
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] Wed Jun 4
16:25:48 2014
@@ -47,7 +47,7 @@
hr = deskbar->QueryInterface(riid, ppv);
if (FAILED_UNEXPECTEDLY(hr))
- deskbar->Release();
+ delete deskbar;
#endif
return hr;
Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -52,7 +52,7 @@
public:
CMenuDeskBar();
- ~CMenuDeskBar();
+ virtual ~CMenuDeskBar();
DECLARE_NOT_AGGREGATABLE(CMenuDeskBar)
DECLARE_PROTECT_FINAL_CONSTRUCT()
Modified: branches/shell-experiments/base/shell/rshell/CMenuSite.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuSite.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuSite.cpp [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -45,7 +45,7 @@
hr = site->QueryInterface(riid, ppv);
if (FAILED_UNEXPECTEDLY(hr))
- site->Release();
+ delete site;
#endif
return hr;
Modified: branches/shell-experiments/base/shell/rshell/CMenuSite.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMenuSite.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMenuSite.h [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -39,7 +39,7 @@
public:
CMenuSite();
- ~CMenuSite() {}
+ virtual ~CMenuSite() {}
DECLARE_WND_CLASS_EX(_T("MenuSite"), 0, COLOR_MENU)
Modified: branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/rshell/CMergedFolder.cpp [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -36,7 +36,7 @@
public:
CEnumMergedFolder() : m_UserLocal(NULL), m_AllUSers(NULL), m_FirstDone(FALSE) {}
- ~CEnumMergedFolder() {}
+ virtual ~CEnumMergedFolder() {}
DECLARE_NOT_AGGREGATABLE(CEnumMergedFolder)
DECLARE_PROTECT_FINAL_CONSTRUCT()
@@ -139,7 +139,7 @@
hr = fld->QueryInterface(riid, ppv);
if (FAILED_UNEXPECTEDLY(hr))
- fld->Release();
+ delete fld;
return hr;
}
Modified: branches/shell-experiments/base/shell/rshell/CMergedFolder.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
==============================================================================
--- branches/shell-experiments/base/shell/rshell/CMergedFolder.h [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/rshell/CMergedFolder.h [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -29,7 +29,7 @@
public:
CMergedFolder() {}
- ~CMergedFolder() {}
+ virtual ~CMergedFolder() {}
HRESULT _SetSources(IShellFolder* userLocal, IShellFolder* allUSers);
Modified: branches/shell-experiments/dll/win32/browseui/addressband.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/addressband.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/addressband.cpp [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -111,15 +111,9 @@
HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
{
CComPtr<IBrowserService> browserService;
- CComPtr<IOleWindow> oleWindow;
CComPtr<IShellService> shellService;
- CComPtr<IUnknown> offset34;
HWND parentWindow;
HWND combobox;
- static const TBBUTTON buttonInfo[] = { {0, 1, TBSTATE_ENABLED, 0}
};
- HIMAGELIST normalImagelist;
- HIMAGELIST hotImageList;
- HINSTANCE shellInstance;
HRESULT hResult;
if (pUnkSite == NULL)
@@ -137,7 +131,7 @@
// get window handle of parent
parentWindow = NULL;
- hResult = IUnknown_GetWindow(pUnkSite, &parentWindow);
+ hResult = IUnknown_GetWindow(fSite, &parentWindow);
if (!::IsWindow(parentWindow))
return E_FAIL;
@@ -182,35 +176,43 @@
// TODO: properly initialize this from registry
fGoButtonShown = true;
- shellInstance = GetModuleHandle(_T("shell32.dll"));
- normalImagelist = ImageList_LoadImageW(shellInstance,
MAKEINTRESOURCE(IDB_GOBUTTON_NORMAL),
- 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
- hotImageList = ImageList_LoadImageW(shellInstance,
MAKEINTRESOURCE(IDB_GOBUTTON_HOT),
- 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
-
- fGoButton = CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAMEW, 0, WS_CHILD |
WS_CLIPSIBLINGS |
- WS_CLIPCHILDREN | TBSTYLE_LIST | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS | CCS_NODIVIDER
|
- CCS_NOPARENTALIGN | CCS_NORESIZE,
- 0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
- SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
- SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0);
- if (normalImagelist)
- SendMessage(fGoButton, TB_SETIMAGELIST, 0,
reinterpret_cast<LPARAM>(normalImagelist));
- if (hotImageList)
- SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0,
reinterpret_cast<LPARAM>(hotImageList));
- SendMessage(fGoButton, TB_ADDSTRINGW,
- reinterpret_cast<WPARAM>(_AtlBaseModule.GetResourceInstance()),
IDS_GOBUTTONLABEL);
- SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM)&buttonInfo);
-
- IImageList * piml;
- HRESULT hr = SHGetImageList(SHIL_SMALL, IID_PPV_ARG(IImageList, &piml));
- if (FAILED_UNEXPECTEDLY(hr))
- {
- SendMessageW(combobox, CBEM_SETIMAGELIST, 0, 0);
- }
- else
- {
- SendMessageW(combobox, CBEM_SETIMAGELIST, 0,
reinterpret_cast<LPARAM>(piml));
+ if (fGoButtonShown)
+ {
+ const TBBUTTON buttonInfo [] = { { 0, 1, TBSTATE_ENABLED, 0 } };
+ HIMAGELIST normalImagelist;
+ HIMAGELIST hotImageList;
+ HINSTANCE shellInstance;
+
+ shellInstance = GetModuleHandle(_T("shell32.dll"));
+ normalImagelist = ImageList_LoadImageW(shellInstance,
MAKEINTRESOURCE(IDB_GOBUTTON_NORMAL),
+ 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
+ hotImageList = ImageList_LoadImageW(shellInstance,
MAKEINTRESOURCE(IDB_GOBUTTON_HOT),
+ 20, 0, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION);
+
+ fGoButton = CreateWindowEx(WS_EX_TOOLWINDOW, TOOLBARCLASSNAMEW, 0, WS_CHILD |
WS_CLIPSIBLINGS |
+ WS_CLIPCHILDREN | TBSTYLE_LIST | TBSTYLE_FLAT | TBSTYLE_TOOLTIPS |
CCS_NODIVIDER |
+ CCS_NOPARENTALIGN | CCS_NORESIZE,
+ 0, 0, 0, 0, m_hWnd, NULL, _AtlBaseModule.GetModuleInstance(), NULL);
+ SendMessage(fGoButton, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
+ SendMessage(fGoButton, TB_SETMAXTEXTROWS, 1, 0);
+ if (normalImagelist)
+ SendMessage(fGoButton, TB_SETIMAGELIST, 0,
reinterpret_cast<LPARAM>(normalImagelist));
+ if (hotImageList)
+ SendMessage(fGoButton, TB_SETHOTIMAGELIST, 0,
reinterpret_cast<LPARAM>(hotImageList));
+ SendMessage(fGoButton, TB_ADDSTRINGW,
+ reinterpret_cast<WPARAM>(_AtlBaseModule.GetResourceInstance()),
IDS_GOBUTTONLABEL);
+ SendMessage(fGoButton, TB_ADDBUTTONSW, 1, (LPARAM) &buttonInfo);
+
+ IImageList * piml;
+ HRESULT hr = SHGetImageList(SHIL_SMALL, IID_PPV_ARG(IImageList, &piml));
+ if (FAILED_UNEXPECTEDLY(hr))
+ {
+ SendMessageW(combobox, CBEM_SETIMAGELIST, 0, 0);
+ }
+ else
+ {
+ SendMessageW(combobox, CBEM_SETIMAGELIST, 0,
reinterpret_cast<LPARAM>(piml));
+ }
}
// take advice to watch events
@@ -251,6 +253,9 @@
DestroyWindow();
m_hWnd = NULL;
+
+ if (fAddressEditBox) fAddressEditBox.Release();
+ if (fSite) fSite.Release();
return S_OK;
}
@@ -662,8 +667,8 @@
HRESULT CreateAddressBand(REFIID riid, void **ppv)
{
- CComObject<CAddressBand> *theMenuBar;
- HRESULT hResult;
+ CAddressBand *theMenuBar;
+ HRESULT hResult;
if (ppv == NULL)
return E_POINTER;
Modified: branches/shell-experiments/dll/win32/browseui/addressband.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/addressband.h [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/addressband.h [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -45,7 +45,7 @@
DWORD fAdviseCookie;
public:
CAddressBand();
- ~CAddressBand();
+ virtual ~CAddressBand();
private:
void FocusChange(BOOL bFocus);
public:
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Wed Jun
4 16:25:48 2014
@@ -93,6 +93,44 @@
if (FAILED(hr))
return hr;
return pio->TranslateAcceleratorIO(pmsg);
+}
+
+HRESULT IUnknown_RelayWinEvent(IUnknown * punk, HWND hWnd, UINT uMsg, WPARAM wParam,
LPARAM lParam, LRESULT *theResult)
+{
+ CComPtr<IWinEventHandler> menuWinEventHandler;
+ HRESULT hResult = punk->QueryInterface(IID_PPV_ARG(IWinEventHandler,
&menuWinEventHandler));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ hResult = menuWinEventHandler->IsWindowOwner(hWnd);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ if (hResult == S_OK)
+ return menuWinEventHandler->OnWinEvent(hWnd, uMsg, wParam, lParam,
theResult);
+ return S_FALSE;
+}
+
+HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow)
+{
+ CComPtr<IDockingWindow> dockingWindow;
+ HRESULT hResult = punk->QueryInterface(IID_PPV_ARG(IDockingWindow,
&dockingWindow));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ hResult = dockingWindow->ShowDW(fShow);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ return S_OK;
+}
+
+HRESULT IUnknown_CloseDW(IUnknown * punk, DWORD dwReserved)
+{
+ CComPtr<IDockingWindow> dockingWindow;
+ HRESULT hResult = punk->QueryInterface(IID_PPV_ARG(IDockingWindow,
&dockingWindow));
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ hResult = dockingWindow->CloseDW(dwReserved);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ return S_OK;
}
typedef HRESULT(*PMENUBAND_CONSTRUCTOR)(REFIID riid, void **ppv);
@@ -180,31 +218,19 @@
HRESULT CDockSite::Initialize(IUnknown *containedBand, CInternetToolbar *browser, HWND
hwnd, int bandID, int flags)
{
- CComPtr<IObjectWithSite> child;
- CComPtr<IOleWindow> oleWindow;
- CComPtr<IDeskBand> deskBand;
TCHAR textBuffer[40];
REBARBANDINFOW bandInfo;
HRESULT hResult;
- hResult = containedBand->QueryInterface(IID_PPV_ARG(IObjectWithSite,
&child));
- if (FAILED(hResult))
- return hResult;
- hResult = containedBand->QueryInterface(IID_PPV_ARG(IOleWindow, &oleWindow));
- if (FAILED(hResult))
- return hResult;
- hResult = containedBand->QueryInterface(IID_PPV_ARG(IDeskBand, &deskBand));
- if (FAILED(hResult))
- return hResult;
fContainedBand = containedBand;
fToolbar = browser;
fRebarWindow = hwnd;
fBandID = bandID;
fFlags = flags;
- hResult = child->SetSite(static_cast<IOleWindow *>(this));
- if (FAILED(hResult))
- return hResult;
- hResult = oleWindow->GetWindow(&fChildWindow);
+ hResult = IUnknown_SetSite(containedBand, static_cast<IOleWindow *>(this));
+ if (FAILED(hResult))
+ return hResult;
+ hResult = IUnknown_GetWindow(containedBand, &fChildWindow);
if (FAILED(hResult))
return hResult;
@@ -533,10 +559,9 @@
void CInternetToolbar::AddDockItem(IUnknown *newItem, int bandID, int flags)
{
- CDockSite *newSite;
+ CComPtr<CDockSite> newSite;
newSite = new CComObject<CDockSite>;
- newSite->AddRef();
newSite->Initialize(newItem, this, fMainReBar, bandID, flags);
}
@@ -624,10 +649,7 @@
hResult = (*menuBar)->SetMenu((HMENU)V_INTREF(&menuOut), ownerWindow,
SMSET_DONTOWN);
if (FAILED(hResult))
return hResult;
- hResult = (*menuBar)->QueryInterface(IID_PPV_ARG(IOleCommandTarget,
&commandTarget));
- if (FAILED(hResult))
- return hResult;
- hResult = commandTarget->Exec(&CGID_MenuBand, 3, 1, NULL, NULL);
+ hResult = IUnknown_Exec(*menuBar, CGID_MenuBand, 3, 1, NULL, NULL);
if (FAILED(hResult))
return hResult;
return S_OK;
@@ -635,43 +657,25 @@
HRESULT CInternetToolbar::CreateBrandBand(IUnknown **logoBar)
{
- CComPtr<IUnknown> tempBand;
- HRESULT hResult;
-
#if 1
- hResult = ::CreateBrandBand(IID_PPV_ARG(IUnknown, logoBar));
+ return ::CreateBrandBand(IID_PPV_ARG(IUnknown, logoBar));
#else
- hResult = CoCreateInstance(CLSID_BrandBand, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IUnknown, logoBar));
+ return CoCreateInstance(CLSID_BrandBand, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IUnknown, logoBar));
#endif
- if (FAILED(hResult))
- return hResult;
- return S_OK;
}
HRESULT CInternetToolbar::CreateToolsBar(IUnknown **toolsBar)
{
- HRESULT hResult;
-
- hResult = ::CreateToolsBar(IID_PPV_ARG(IUnknown, toolsBar));
- if (FAILED(hResult))
- return hResult;
- return S_OK;
+ return ::CreateToolsBar(IID_PPV_ARG(IUnknown, toolsBar));
}
HRESULT CInternetToolbar::CreateAddressBand(IUnknown **toolsBar)
{
- CComPtr<IAddressBand> addressBand;
- HRESULT hResult;
-
#if 1
- hResult = ::CreateAddressBand(IID_PPV_ARG(IUnknown, toolsBar));
+ return ::CreateAddressBand(IID_PPV_ARG(IUnknown, toolsBar));
#else
- hResult = CoCreateInstance(CLSID_SH_AddressBand, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IUnknown, toolsBar));
+ return CoCreateInstance(CLSID_SH_AddressBand, NULL, CLSCTX_INPROC_SERVER,
IID_PPV_ARG(IUnknown, toolsBar));
#endif
- if (FAILED(hResult))
- return hResult;
- hResult = (*toolsBar)->QueryInterface(IID_PPV_ARG(IAddressBand,
&addressBand));
- return S_OK;
}
HRESULT CInternetToolbar::LockUnlockToolbars(bool locked)
@@ -825,43 +829,54 @@
if (fShow)
{
hResult = ReserveBorderSpace();
- }
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ }
+
if (fMenuBar)
{
- CComPtr<IDockingWindow> dockingWindow;
- hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IDockingWindow,
&dockingWindow));
- hResult = dockingWindow->ShowDW(fShow);
- }
+ hResult = IUnknown_ShowDW(fMenuBar, fShow);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ }
+
if (fControlsBar)
{
- CComPtr<IDockingWindow> dockingWindow;
- hResult = fControlsBar->QueryInterface(IID_PPV_ARG(IDockingWindow,
&dockingWindow));
- hResult = dockingWindow->ShowDW(fShow);
+ hResult = IUnknown_ShowDW(fControlsBar, fShow);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
}
if (fNavigationBar)
{
- CComPtr<IDockingWindow> dockingWindow;
- hResult = fNavigationBar->QueryInterface(IID_PPV_ARG(IDockingWindow,
&dockingWindow));
- hResult = dockingWindow->ShowDW(fShow);
+ hResult = IUnknown_ShowDW(fNavigationBar, fShow);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
}
if (fLogoBar)
{
- CComPtr<IDockingWindow> dockingWindow;
- hResult = fLogoBar->QueryInterface(IID_PPV_ARG(IDockingWindow,
&dockingWindow));
- hResult = dockingWindow->ShowDW(fShow);
+ hResult = IUnknown_ShowDW(fLogoBar, fShow);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
}
return S_OK;
}
template<class T>
-void ReleaseCComPtrExpectZero(CComPtr<T>& cptr)
+void ReleaseCComPtrExpectZero(CComPtr<T>& cptr, BOOL forceRelease = FALSE)
{
if (cptr.p != NULL)
{
int nrc = cptr->Release();
if (nrc > 0)
{
- DbgPrint("WARNING: Unexpected RefCount > 0!\n");
+ DbgPrint("WARNING: Unexpected RefCount > 0 (%d)!\n", nrc);
+ if (forceRelease)
+ {
+ while (nrc > 0)
+ {
+ nrc = cptr->Release();
+ }
+ }
}
cptr.Detach();
}
@@ -873,32 +888,32 @@
if (fMenuBar)
{
- CComPtr<IDockingWindow> dockingWindow;
- hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IDockingWindow,
&dockingWindow));
- hResult = dockingWindow->CloseDW(dwReserved);
- }
- ReleaseCComPtrExpectZero(fMenuBar);
+ hResult = IUnknown_CloseDW(fMenuBar, dwReserved);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ ReleaseCComPtrExpectZero(fMenuBar);
+ }
if (fControlsBar)
{
- CComPtr<IDockingWindow> dockingWindow;
- hResult = fControlsBar->QueryInterface(IID_PPV_ARG(IDockingWindow,
&dockingWindow));
- hResult = dockingWindow->CloseDW(dwReserved);
- }
- ReleaseCComPtrExpectZero(fControlsBar);
+ hResult = IUnknown_CloseDW(fControlsBar, dwReserved);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ ReleaseCComPtrExpectZero(fControlsBar);
+ }
if (fNavigationBar)
{
- CComPtr<IDockingWindow> dockingWindow;
- hResult = fNavigationBar->QueryInterface(IID_PPV_ARG(IDockingWindow,
&dockingWindow));
- hResult = dockingWindow->CloseDW(dwReserved);
- }
- ReleaseCComPtrExpectZero(fNavigationBar);
+ hResult = IUnknown_CloseDW(fNavigationBar, dwReserved);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ ReleaseCComPtrExpectZero(fNavigationBar);
+ }
if (fLogoBar)
{
- CComPtr<IDockingWindow> dockingWindow;
- hResult = fLogoBar->QueryInterface(IID_PPV_ARG(IDockingWindow,
&dockingWindow));
- hResult = dockingWindow->CloseDW(dwReserved);
- }
- ReleaseCComPtrExpectZero(fLogoBar);
+ hResult = IUnknown_CloseDW(fLogoBar, dwReserved);
+ if (FAILED_UNEXPECTEDLY(hResult))
+ return hResult;
+ ReleaseCComPtrExpectZero(fLogoBar);
+ }
return S_OK;
}
@@ -971,9 +986,6 @@
CComPtr<IUnknown> logoBar;
CComPtr<IUnknown> toolsBar;
CComPtr<IUnknown> navigationBar;
- CComPtr<IOleWindow> menuOleWindow;
- CComPtr<IOleWindow> toolbarOleWindow;
- CComPtr<IOleWindow> navigationOleWindow;
HRESULT hResult;
/* Create and attach the menubar to the rebar */
@@ -982,8 +994,7 @@
return hResult;
AddDockItem(menuBar, ITBBID_MENUBAND, CDockSite::ITF_NOTITLE |
CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
- hResult = menuBar->QueryInterface(IID_PPV_ARG(IOleWindow, &menuOleWindow));
- hResult = menuOleWindow->GetWindow(&fMenuBandWindow);
+ hResult = IUnknown_GetWindow(menuBar, &fMenuBandWindow);
fMenuBar.Attach(menuBar.Detach()); // transfer the ref count
// FIXME: The ros Rebar does not properly support fixed-size items such as the
brandband,
@@ -1003,10 +1014,7 @@
return hResult;
AddDockItem(toolsBar, ITBBID_TOOLSBAND, CDockSite::ITF_NOTITLE |
CDockSite::ITF_NEWBANDALWAYS | CDockSite::ITF_GRIPPERALWAYS);
fControlsBar.Attach(toolsBar.Detach()); // transfer the ref count
- hResult = fControlsBar->QueryInterface(IID_PPV_ARG(IOleWindow,
&toolbarOleWindow));
- if (FAILED(hResult))
- return hResult;
- hResult = toolbarOleWindow->GetWindow(&fToolbarWindow);
+ hResult = IUnknown_GetWindow(fControlsBar, &fToolbarWindow);
if (FAILED(hResult))
return hResult;
@@ -1015,9 +1023,8 @@
if (FAILED(hResult))
return hResult;
AddDockItem(navigationBar, ITBBID_ADDRESSBAND, CDockSite::ITF_NEWBANDALWAYS |
CDockSite::ITF_GRIPPERALWAYS);
- hResult = navigationBar->QueryInterface(IID_PPV_ARG(IOleWindow,
&navigationOleWindow));
- hResult = navigationOleWindow->GetWindow(&fNavigationWindow);
fNavigationBar.Attach(navigationBar.Detach());
+ hResult = IUnknown_GetWindow(fNavigationBar, &fNavigationWindow);
return S_OK;
}
@@ -1330,16 +1337,27 @@
HRESULT STDMETHODCALLTYPE CInternetToolbar::OnWinEvent(
HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{
- CComPtr<IWinEventHandler> menuWinEventHandler;
HRESULT hResult;
if (fMenuBar)
{
- hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IWinEventHandler,
&menuWinEventHandler));
- if (menuWinEventHandler->IsWindowOwner(hWnd) == S_OK)
- {
- return menuWinEventHandler->OnWinEvent(fMenuBandWindow, uMsg, wParam,
lParam, theResult);
- }
+ hResult = IUnknown_RelayWinEvent(fMenuBar, hWnd, uMsg, wParam, lParam,
theResult);
+ if (hResult != S_FALSE)
+ return hResult;
+ }
+
+ if (fNavigationBar)
+ {
+ hResult = IUnknown_RelayWinEvent(fNavigationBar, hWnd, uMsg, wParam, lParam,
theResult);
+ if (hResult != S_FALSE)
+ return hResult;
+ }
+
+ if (fLogoBar)
+ {
+ hResult = IUnknown_RelayWinEvent(fLogoBar, hWnd, uMsg, wParam, lParam,
theResult);
+ if (hResult != S_FALSE)
+ return hResult;
}
return S_FALSE;
@@ -1347,16 +1365,19 @@
HRESULT STDMETHODCALLTYPE CInternetToolbar::IsWindowOwner(HWND hWnd)
{
+ UNIMPLEMENTED;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CInternetToolbar::AddBand(IUnknown *punk)
{
+ UNIMPLEMENTED;
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CInternetToolbar::EnumBands(UINT uBand, DWORD *pdwBandID)
{
+ UNIMPLEMENTED;
return E_NOTIMPL;
}
@@ -1751,37 +1772,12 @@
{
LRESULT theResult;
HRESULT hResult;
- HWND target = (HWND) lParam;
-
- if (fMenuBar)
- {
- CComPtr<IWinEventHandler> menuWinEventHandler;
- hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IWinEventHandler,
&menuWinEventHandler));
- if (SUCCEEDED(hResult))
- {
- if (menuWinEventHandler->IsWindowOwner(target) == S_OK)
- {
- hResult = menuWinEventHandler->OnWinEvent(target, uMsg, wParam,
lParam, &theResult);
- return FAILED(hResult) ? 0 : theResult;
- }
- }
- }
-
- if (fNavigationBar)
- {
- CComPtr<IWinEventHandler> menuWinEventHandler;
- hResult = fNavigationBar->QueryInterface(IID_PPV_ARG(IWinEventHandler,
&menuWinEventHandler));
- if (SUCCEEDED(hResult))
- {
- if (menuWinEventHandler->IsWindowOwner(target) == S_OK)
- {
- hResult = menuWinEventHandler->OnWinEvent(target, uMsg, wParam,
lParam, &theResult);
- return FAILED(hResult) ? 0 : theResult;
- }
- }
- }
-
- return 0;
+
+ hResult = OnWinEvent((HWND) lParam, uMsg, wParam, lParam, &theResult);
+
+ bHandled = hResult == S_OK;
+
+ return FAILED_UNEXPECTEDLY(hResult) ? 0 : theResult;
}
LRESULT CInternetToolbar::OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&bHandled)
{
@@ -1789,37 +1785,13 @@
LRESULT theResult;
HRESULT hResult;
- notifyHeader = (NMHDR *) lParam;
-
- if (fMenuBar)
- {
- CComPtr<IWinEventHandler> menuWinEventHandler;
- hResult = fMenuBar->QueryInterface(IID_PPV_ARG(IWinEventHandler,
&menuWinEventHandler));
- if (SUCCEEDED(hResult))
- {
- if (menuWinEventHandler->IsWindowOwner(notifyHeader->hwndFrom) ==
S_OK)
- {
- hResult = menuWinEventHandler->OnWinEvent(notifyHeader->hwndFrom,
uMsg, wParam, lParam, &theResult);
- return FAILED(hResult) ? 0 : theResult;
- }
- }
- }
-
- if (fNavigationBar)
- {
- CComPtr<IWinEventHandler> menuWinEventHandler;
- hResult = fNavigationBar->QueryInterface(IID_PPV_ARG(IWinEventHandler,
&menuWinEventHandler));
- if (SUCCEEDED(hResult))
- {
- if (menuWinEventHandler->IsWindowOwner(notifyHeader->hwndFrom) ==
S_OK)
- {
- hResult = menuWinEventHandler->OnWinEvent(notifyHeader->hwndFrom,
uMsg, wParam, lParam, &theResult);
- return FAILED(hResult) ? 0 : theResult;
- }
- }
- }
-
- return 0;
+ notifyHeader = reinterpret_cast<NMHDR *>(lParam);
+
+ hResult = OnWinEvent(notifyHeader->hwndFrom, uMsg, wParam, lParam,
&theResult);
+
+ bHandled = hResult == S_OK;
+
+ return FAILED_UNEXPECTEDLY(hResult) ? 0 : theResult;
}
LRESULT CInternetToolbar::OnLDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL
&bHandled)
@@ -1884,8 +1856,8 @@
HRESULT CreateInternetToolbar(REFIID riid, void **ppv)
{
- CComObject<CInternetToolbar> *theToolbar;
- HRESULT hResult;
+ CInternetToolbar *theToolbar;
+ HRESULT hResult;
if (ppv == NULL)
return E_POINTER;
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/internettoolbar.h [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/internettoolbar.h [iso-8859-1] Wed Jun
4 16:25:48 2014
@@ -45,7 +45,7 @@
CComPtr<IShellMenu> fFavoritesMenu;
public:
CMenuCallback();
- ~CMenuCallback();
+ virtual ~CMenuCallback();
HRESULT STDMETHODCALLTYPE GetObject(LPSMDATA psmd, REFIID riid, void **ppvObject);
public:
@@ -94,7 +94,7 @@
LONG fStartHeight;
public:
CInternetToolbar();
- ~CInternetToolbar();
+ virtual ~CInternetToolbar();
void AddDockItem(IUnknown *newItem, int bandID, int flags);
HRESULT ReserveBorderSpace(LONG maxHeight = -1);
HRESULT CreateMenuBar(IShellMenu **menuBar);
Modified: branches/shell-experiments/dll/win32/browseui/precomp.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/precomp.h [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/precomp.h [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -82,6 +82,78 @@
#define FAILED_UNEXPECTEDLY(hr) FAILED(hr)
#endif
+
+template <class Base>
+class CComDebugObject : public Base
+{
+public:
+ CComDebugObject(void * = NULL)
+ {
+ _pAtlModule->Lock();
+ }
+
+ virtual ~CComDebugObject()
+ {
+ this->FinalRelease();
+ _pAtlModule->Unlock();
+ }
+
+ STDMETHOD_(ULONG, AddRef)()
+ {
+ int rc = this->InternalAddRef();
+ DbgPrint("RefCount is now %d(++)!\n", rc);
+ return rc;
+ }
+
+ STDMETHOD_(ULONG, Release)()
+ {
+ ULONG newRefCount;
+
+ newRefCount = this->InternalRelease();
+ DbgPrint("RefCount is now %d(--)!\n", newRefCount);
+ if (newRefCount == 0)
+ delete this;
+ return newRefCount;
+ }
+
+ STDMETHOD(QueryInterface)(REFIID iid, void **ppvObject)
+ {
+ return this->_InternalQueryInterface(iid, ppvObject);
+ }
+
+ static HRESULT WINAPI CreateInstance(CComDebugObject<Base> **pp)
+ {
+ CComDebugObject<Base> *newInstance;
+ HRESULT hResult;
+
+ ATLASSERT(pp != NULL);
+ if (pp == NULL)
+ return E_POINTER;
+
+ hResult = E_OUTOFMEMORY;
+ newInstance = NULL;
+ ATLTRY(newInstance = new CComDebugObject<Base>())
+ if (newInstance != NULL)
+ {
+ newInstance->SetVoid(NULL);
+ newInstance->InternalFinalConstructAddRef();
+ hResult = newInstance->_AtlInitialConstruct();
+ if (SUCCEEDED(hResult))
+ hResult = newInstance->FinalConstruct();
+ if (SUCCEEDED(hResult))
+ hResult = newInstance->_AtlFinalConstruct();
+ newInstance->InternalFinalConstructRelease();
+ if (hResult != S_OK)
+ {
+ delete newInstance;
+ newInstance = NULL;
+ }
+ }
+ *pp = newInstance;
+ return hResult;
+ }
+};
+
WINE_DEFAULT_DEBUG_CHANNEL(browseui);
#endif /* _BROWSEUI_PCH_ */
Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -28,6 +28,8 @@
_Out_ HIMAGELIST *phiml,
_Out_ HIMAGELIST *phimlSmall
);
+
+extern HRESULT IUnknown_ShowDW(IUnknown * punk, BOOL fShow);
#include "newatlinterfaces.h"
@@ -732,12 +734,9 @@
HRESULT CShellBrowser::Initialize(LPITEMIDLIST pidl, long b, long c, long d)
{
- CComPtr<IDockingWindow> dockingWindow;
- CComPtr<IStream> settingsStream;
CComPtr<IPersistStreamInit> persistStreamInit;
- CComPtr<IOleCommandTarget> commandTarget;
- CComPtr<IObjectWithSite> objectSite;
- HRESULT hResult;
+ HRESULT hResult;
+ CComPtr<IUnknown> clientBar;
_AtlInitialConstruct();
@@ -756,61 +755,53 @@
if (FAILED(hResult))
return hResult;
#else
- hResult = CreateInternetToolbar(IID_PPV_ARG(IUnknown,
&fClientBars[BIInternetToolbar].clientBar));
+ hResult = CreateInternetToolbar(IID_PPV_ARG(IUnknown, &clientBar));
if (FAILED(hResult))
return hResult;
#endif
+ fClientBars[BIInternetToolbar].clientBar = clientBar;
+
// create interfaces
- hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
- IID_PPV_ARG(IDockingWindow, &dockingWindow));
- if (FAILED(hResult))
+ hResult = clientBar->QueryInterface(IID_PPV_ARG(IPersistStreamInit,
&persistStreamInit));
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
- hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
- IID_PPV_ARG(IPersistStreamInit, &persistStreamInit));
+
+ hResult = IUnknown_SetSite(clientBar, static_cast<IShellBrowser *>(this));
if (FAILED(hResult))
return hResult;
- hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
- IID_PPV_ARG(IOleCommandTarget, &commandTarget));
+
+ hResult = IUnknown_Exec(clientBar, CGID_PrivCITCommands, 1, 1 /* or 0 */, NULL,
NULL);
if (FAILED(hResult))
return hResult;
- hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
- IID_PPV_ARG(IObjectWithSite, &objectSite));
- if (FAILED(hResult))
- return hResult;
-
- hResult = objectSite->SetSite(static_cast<IShellBrowser *>(this));
- if (FAILED(hResult))
- return hResult;
-
- hResult = commandTarget->Exec(&CGID_PrivCITCommands, 1, 1 /* or 0 */, NULL,
NULL);
- if (FAILED(hResult))
- return hResult;
// TODO: create settingsStream from registry entry
- if (settingsStream.p == NULL)
+ //if (settingsStream.p)
+ //{
+ // hResult = persistStreamInit->Load(settingsStream);
+ // if (FAILED_UNEXPECTEDLY(hResult))
+ // return hResult;
+ //}
+ //else
{
hResult = persistStreamInit->InitNew();
if (FAILED(hResult))
return hResult;
}
- else
- {
- hResult = persistStreamInit->Load(settingsStream);
- if (FAILED(hResult))
- return hResult;
- }
- hResult = dockingWindow->ShowDW(TRUE);
- if (FAILED(hResult))
+
+ hResult = IUnknown_ShowDW(clientBar, TRUE);
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
- fToolbarProxy.Initialize(m_hWnd, fClientBars[BIInternetToolbar].clientBar);
+ fToolbarProxy.Initialize(m_hWnd, clientBar);
+
// create status bar
fStatusBar = CreateWindow(STATUSCLASSNAMEW, NULL, WS_CHILD | WS_VISIBLE |
WS_CLIPSIBLINGS |
SBT_NOBORDERS | SBT_TOOLTIPS, 0, 0, 500, 20, m_hWnd, (HMENU)0xa001,
_AtlBaseModule.GetModuleInstance(), 0);
fStatusBarVisible = true;
+
// browse
hResult = BrowseToPIDL(pidl, BTP_UPDATE_NEXT_HISTORY);
@@ -1091,14 +1082,8 @@
CComPtr<IDeskBand> deskBand;
HRESULT hResult;
- if (fClientBars[BIInternetToolbar].clientBar.p == NULL)
- return E_FAIL;
- hResult = fClientBars[BIInternetToolbar].clientBar->QueryInterface(
- IID_PPV_ARG(IServiceProvider, &serviceProvider));
- if (FAILED(hResult))
- return hResult;
- hResult = serviceProvider->QueryService(SID_IBandSite, IID_PPV_ARG(IBandSite,
&bandSite));
- if (FAILED(hResult))
+ hResult = IUnknown_QueryService(fClientBars[BIInternetToolbar].clientBar,
SID_IBandSite, IID_PPV_ARG(IBandSite, &bandSite));
+ if (FAILED_UNEXPECTEDLY(hResult))
return hResult;
hResult = bandSite->QueryBand(1, &deskBand, NULL, NULL, 0);
if (FAILED(hResult))
@@ -1291,7 +1276,6 @@
CShellBrowser *pThis = reinterpret_cast<CShellBrowser
*>(hWnd);
_ATL_MSG msg(pThis->m_hWnd, uMsg, wParam, lParam);
LRESULT lResult;
- CComPtr<IMenuBand> menuBand;
const _ATL_MSG *previousMessage;
BOOL handled;
WNDPROC saveWindowProc;
@@ -1301,6 +1285,7 @@
previousMessage = pThis->m_pCurrentMsg;
pThis->m_pCurrentMsg = &msg;
+ CComPtr<IMenuBand> menuBand;
hResult = pThis->GetMenuBand(IID_PPV_ARG(IMenuBand, &menuBand));
if (SUCCEEDED(hResult) && menuBand.p != NULL)
{
@@ -1311,6 +1296,7 @@
wParam = msg.wParam;
lParam = msg.lParam;
}
+ menuBand.Release();
handled = pThis->ProcessWindowMessage(hWnd, uMsg, wParam, lParam, lResult, 0);
ATLASSERT(pThis->m_pCurrentMsg == &msg);
@@ -1867,7 +1853,7 @@
CComPtr<IShellMenu> shellMenu;
HRESULT hResult;
- if (IsMenu(hmenuShared) == FALSE)
+ if (hmenuShared && IsMenu(hmenuShared) == FALSE)
return E_FAIL;
hResult = GetMenuBand(IID_PPV_ARG(IShellMenu, &shellMenu));
if (FAILED(hResult))
@@ -1882,7 +1868,10 @@
HRESULT STDMETHODCALLTYPE CShellBrowser::RemoveMenusSB(HMENU hmenuShared)
{
if (hmenuShared == fCurrentMenuBar)
- fCurrentMenuBar = NULL;
+ {
+ //DestroyMenu(fCurrentMenuBar);
+ SetMenuSB(NULL, NULL, NULL);
+ }
return S_OK;
}
@@ -3072,7 +3061,7 @@
}
template<class T>
-void ReleaseCComPtrExpectZero(CComPtr<T>& cptr)
+void ReleaseCComPtrExpectZero(CComPtr<T>& cptr, BOOL forceRelease = FALSE)
{
if (cptr.p != NULL)
{
@@ -3080,6 +3069,13 @@
if (nrc > 0)
{
DbgPrint("WARNING: Unexpected RefCount > 0!\n");
+ if (forceRelease)
+ {
+ while (nrc > 0)
+ {
+ nrc = cptr->Release();
+ }
+ }
}
cptr.Detach();
}
@@ -3361,8 +3357,8 @@
static HRESULT ExplorerMessageLoop(IEThreadParamBlock * parameters)
{
- CComPtr< CComObject<CShellBrowser> > theCabinet;
- HRESULT hResult;
+ CComPtr<CShellBrowser> theCabinet;
+ HRESULT hResult;
MSG Msg;
BOOL Ret;
@@ -3384,14 +3380,14 @@
break;
}
+ if (Msg.message == WM_QUIT)
+ break;
+
if (theCabinet->v_MayTranslateAccelerator(&Msg) != S_OK)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
-
- if (Msg.message == WM_QUIT)
- break;
}
//TerminateProcess(GetCurrentProcess(), hResult);
@@ -3399,7 +3395,9 @@
int nrc = theCabinet->Release();
if (nrc > 0)
{
- DbgPrint("WARNING: There are %d references to the CShellBrowser active or
leaked, process will never terminate.\n");
+ DbgPrint("WARNING: There are %d references to the CShellBrowser active or
leaked, process will never terminate. Terminating forcefully.\n", nrc);
+
+ //TerminateProcess(GetCurrentProcess(), 1);
}
theCabinet.Detach();
Modified: branches/shell-experiments/dll/win32/browseui/toolsband.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/toolsband.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/toolsband.cpp [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -37,12 +37,12 @@
public IPersistStream
{
private:
- IDockingWindowSite *fDockSite;
+ CComPtr<IDockingWindowSite> fDockSite;
GUID fExecCommandCategory;
CComPtr<IOleCommandTarget> fExecCommandTarget;
public:
CToolsBand();
- ~CToolsBand();
+ virtual ~CToolsBand();
public:
// *** IDeskBand methods ***
virtual HRESULT STDMETHODCALLTYPE GetBandInfo(DWORD dwBandID, DWORD dwViewMode,
DESKBANDINFO* pdbi);
@@ -95,14 +95,12 @@
};
CToolsBand::CToolsBand()
-{
- fDockSite = NULL;
+ : fDockSite(NULL)
+{
}
CToolsBand::~CToolsBand()
{
- if (fDockSite)
- fDockSite->Release();
}
HRESULT STDMETHODCALLTYPE CToolsBand::GetBandInfo(DWORD dwBandID, DWORD dwViewMode,
DESKBANDINFO* pdbi)
@@ -267,8 +265,8 @@
HWND toolbar;
HRESULT hResult;
- if (fDockSite != NULL)
- fDockSite->Release();
+ if(fDockSite) fDockSite.Release();
+
if (pUnkSite == NULL)
return S_OK;
hResult = pUnkSite->QueryInterface(IID_PPV_ARG(IDockingWindowSite,
&fDockSite));
@@ -364,6 +362,8 @@
m_hWnd = NULL;
+ if (fDockSite) fDockSite.Release();
+
return S_OK;
}
@@ -440,19 +440,19 @@
HRESULT CreateToolsBar(REFIID riid, void **ppv)
{
- CComObject<CToolsBand> *theMenuBar;
- HRESULT hResult;
+ CToolsBand *theToolbar;
+ HRESULT hResult;
if (ppv == NULL)
return E_POINTER;
*ppv = NULL;
- ATLTRY (theMenuBar = new CComObject<CToolsBand>);
- if (theMenuBar == NULL)
+ ATLTRY(theToolbar = new CComObject<CToolsBand>);
+ if (theToolbar == NULL)
return E_OUTOFMEMORY;
- hResult = theMenuBar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
+ hResult = theToolbar->QueryInterface(riid, reinterpret_cast<void **>(ppv));
if (FAILED(hResult))
{
- delete theMenuBar;
+ delete theToolbar;
return hResult;
}
return S_OK;
Modified: branches/shell-experiments/dll/win32/shell32/shlview.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/she…
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/shlview.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/shell32/shlview.cpp [iso-8859-1] Wed Jun 4
16:25:48 2014
@@ -1382,7 +1382,6 @@
INT mic = GetMenuItemCount(m_hMenu);
for (int i = 0; i < mic; i++)
{
- HMENU submenu = GetSubMenu(m_hMenu, 0);
DeleteMenu(m_hMenu, 0, MF_BYPOSITION);
}