X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fdll%2Fwin32%2Fbrowseui%2Fshellbrowser.cpp;h=db050150bccc90ba586f62f883ceac58d3113029;hp=63c58694caac6750bc1f6f2299f8a8a814c4f15b;hb=2c118e18904ba705a8cd2d0d9c01867161d80fbe;hpb=a0aeb266fab72a935e5591040876563aebca6199 diff --git a/reactos/dll/win32/browseui/shellbrowser.cpp b/reactos/dll/win32/browseui/shellbrowser.cpp index 63c58694caa..db050150bcc 100644 --- a/reactos/dll/win32/browseui/shellbrowser.cpp +++ b/reactos/dll/win32/browseui/shellbrowser.cpp @@ -179,7 +179,7 @@ private: CComPtr fExplorerToolbar; public: void Initialize(HWND parent, IUnknown *explorerToolbar); - + void Destroy(); private: // message handlers @@ -207,6 +207,12 @@ void CToolbarProxy::Initialize(HWND parent, IUnknown *explorerToolbar) } } +void CToolbarProxy::Destroy() +{ + DestroyWindow(); + fExplorerToolbar = NULL; +} + LRESULT CToolbarProxy::OnAddBitmap(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) { long int result; @@ -1116,6 +1122,7 @@ HRESULT CShellBrowser::GetBaseBar(bool vertical, REFIID riid, void **theBaseBar) // 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(this)); @@ -3362,9 +3369,10 @@ LRESULT CShellBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & // TODO: rip down everything { + fToolbarProxy.Destroy(); + fCurrentShellView->DestroyViewWindow(); fCurrentShellView->UIActivate(SVUIA_DEACTIVATE); - ReleaseCComPtrExpectZero(fCurrentShellView); for (int i = 0; i < 3; i++) { @@ -3393,16 +3401,14 @@ LRESULT CShellBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & } } 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();