m_hWnd = NULL;
- IUnknown_SetSite(fAddressEditBox, NULL);
+ CComPtr<IShellService> pservice;
+ HRESULT hres = fAddressEditBox->QueryInterface(IID_PPV_ARG(IShellService, &pservice));
+ if (SUCCEEDED(hres ))
+ pservice->SetOwner(NULL);
if (fAddressEditBox) fAddressEditBox.Release();
if (fSite) fSite.Release();
{
}
-HRESULT STDMETHODCALLTYPE CAddressEditBox::SetOwner(IUnknown *)
+HRESULT STDMETHODCALLTYPE CAddressEditBox::SetOwner(IUnknown *pOwner)
{
+ if (!pOwner)
+ {
+ CComPtr<IBrowserService> browserService;
+ HRESULT hResult = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &browserService));
+ if (SUCCEEDED(hResult))
+ AtlUnadvise(browserService, DIID_DWebBrowserEvents, fAdviseCookie);
+ fSite = NULL;
+ }
// connect to browser connection point
return 0;
}
CComPtr<IExplorerToolbar> fExplorerToolbar;
public:
void Initialize(HWND parent, IUnknown *explorerToolbar);
-
+ void Destroy();
private:
// message handlers
}
}
+void CToolbarProxy::Destroy()
+{
+ DestroyWindow();
+ fExplorerToolbar = NULL;
+}
+
LRESULT CToolbarProxy::OnAddBitmap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
{
long int result;
// we have to store our basebar into cache now
*cache = newBaseBar;
+ newBaseBar->AddRef();
// tell the new base bar about the shell browser
hResult = IUnknown_SetSite(newBaseBar, static_cast<IDropTarget *>(this));
// TODO: rip down everything
{
+ fToolbarProxy.Destroy();
+
fCurrentShellView->DestroyViewWindow();
fCurrentShellView->UIActivate(SVUIA_DEACTIVATE);
- ReleaseCComPtrExpectZero(fCurrentShellView);
for (int i = 0; i < 3; i++)
{
}
}
pdw->CloseDW(0);
+
+ pClient = NULL;
+ pBarSite = NULL;
pdw = NULL;
- /* For some reasons, it's like we miss some AddRef in ATL when QueryInterface on
- * same interface or inherited one, so we are removing already removed (!) object.
- * TODO: check with MSVC's ATL to see if this behaviour happens too
- */
- bar.Detach();
- pClient.Detach();
- pBarSite.Detach();
+ bar = NULL;
ReleaseCComPtrExpectZero(fClientBars[i].clientBar);
}
+ ReleaseCComPtrExpectZero(fCurrentShellView);
ReleaseCComPtrExpectZero(fTravelLog);
fCurrentShellFolder.Release();