[BROWSEUI]
authorThomas Faber <thomas.faber@reactos.org>
Sun, 10 Aug 2014 18:39:05 +0000 (18:39 +0000)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 10 Aug 2014 18:39:05 +0000 (18:39 +0000)
- CComObject cannot be a class member and must be allocated using new. Fixes invalid free.

svn path=/trunk/; revision=63853

reactos/dll/win32/browseui/internettoolbar.cpp
reactos/dll/win32/browseui/internettoolbar.h

index adfd6ef..eeb1f2e 100644 (file)
@@ -481,14 +481,13 @@ CInternetToolbar::CInternetToolbar()
     fLocked = false;
     fMenuBandWindow = NULL;
     fNavigationWindow = NULL;
-    fMenuCallback.AddRef();
+    fMenuCallback = new CComObject<CMenuCallback>();
     fToolbarWindow = NULL;
     fAdviseCookie = 0;
 }
 
 CInternetToolbar::~CInternetToolbar()
 {
-    fMenuCallback.Release();
 }
 
 void CInternetToolbar::AddDockItem(IUnknown *newItem, int bandID, int flags)
@@ -540,7 +539,7 @@ HRESULT CInternetToolbar::CreateMenuBar(IShellMenu **menuBar)
         IID_IShellMenu, reinterpret_cast<void **>(menuBar));
     if (FAILED(hResult))
         return hResult;
-    hResult = fMenuCallback.QueryInterface(IID_IShellMenuCallback, reinterpret_cast<void **>(&callback));
+    hResult = fMenuCallback->QueryInterface(IID_IShellMenuCallback, reinterpret_cast<void **>(&callback));
     if (FAILED(hResult))
         return hResult;
     hResult = (*menuBar)->Initialize(callback, -1, ANCESTORDEFAULT, SMINIT_HORIZONTAL | SMINIT_TOPLEVEL);
index 71520e3..ef3e1af 100644 (file)
@@ -90,7 +90,7 @@ public:
     CComPtr<IUnknown>                       fLogoBar;           // the reactos logo
     CComPtr<IUnknown>                       fControlsBar;       // navigation controls
     CComPtr<IUnknown>                       fNavigationBar;     // address bar
-    CComObject<CMenuCallback>               fMenuCallback;
+    CComPtr<CMenuCallback>                  fMenuCallback;
     CComPtr<IOleCommandTarget>              fCommandTarget;
     GUID                                    fCommandCategory;
     HWND                                    fToolbarWindow;