From: Steve Lamerton Date: Sun, 21 Oct 2012 20:33:48 +0000 (+0000) Subject: Explicitly unregister custom wxWebViewIE namespaces when we are done with them. Also... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8626e0b73de21463908bf855700c31e41c661b30 Explicitly unregister custom wxWebViewIE namespaces when we are done with them. Also add a missing ClassFactory::AddRef. Closes #14749 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72715 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/webview_ie.h b/include/wx/msw/webview_ie.h index ca6feb4924..9e038ebe3d 100644 --- a/include/wx/msw/webview_ie.h +++ b/include/wx/msw/webview_ie.h @@ -241,7 +241,10 @@ public: class ClassFactory : public IClassFactory { public: - ClassFactory(wxSharedPtr handler) : m_handler(handler) {} + ClassFactory(wxSharedPtr handler) : m_handler(handler) + { AddRef(); } + + wxString GetName() { return m_handler->GetName(); } //IClassFactory HRESULT STDMETHODCALLTYPE CreateInstance(IUnknown* pUnkOuter, diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index 723c4ed096..0eb1be1c7e 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -104,9 +104,27 @@ bool wxWebViewIE::Create(wxWindow* parent, wxWebViewIE::~wxWebViewIE() { - for(unsigned int i = 0; i < m_factories.size(); i++) + wxDynamicLibrary urlMon(wxT("urlmon.dll")); + if(urlMon.HasSymbol(wxT("CoInternetGetSession"))) { - m_factories[i]->Release(); + typedef HRESULT (WINAPI *CoInternetGetSession_t)(DWORD, + wxIInternetSession**, + DWORD); + wxDYNLIB_FUNCTION(CoInternetGetSession_t, CoInternetGetSession, urlMon); + + wxIInternetSession* session; + HRESULT res = (*pfnCoInternetGetSession)(0, &session, 0); + if(FAILED(res)) + { + wxFAIL_MSG("Could not retrive internet session"); + } + + for(unsigned int i = 0; i < m_factories.size(); i++) + { + session->UnregisterNameSpace(m_factories[i], + (m_factories[i]->GetName()).wc_str()); + m_factories[i]->Release(); + } } FindClear(); }