From 3949871086c97c2cdbfbb139766f0aac52d0df8e Mon Sep 17 00:00:00 2001 From: Steve Lamerton Date: Wed, 5 Oct 2011 17:23:51 +0000 Subject: [PATCH] Store a pointer to each ClassFactory so we can correctly release it when the browser closes. This fixes a few more memory leaks. See #13500 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69314 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/webview_ie.h | 4 ++++ include/wx/webview.h | 1 + src/msw/webview_ie.cpp | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/include/wx/msw/webview_ie.h b/include/wx/msw/webview_ie.h index 407174b0e5..a3ff0b7837 100644 --- a/include/wx/msw/webview_ie.h +++ b/include/wx/msw/webview_ie.h @@ -24,6 +24,7 @@ struct IHTMLDocument2; class wxFSFile; +class ClassFactory; class WXDLLIMPEXP_WEBVIEW wxWebViewIE : public wxWebView { @@ -42,6 +43,8 @@ public: Create(parent, id, url, pos, size, style, name); } + ~wxWebViewIE(); + bool Create(wxWindow* parent, wxWindowID id, const wxString& url = wxWebViewDefaultURLStr, @@ -149,6 +152,7 @@ private: //an item from the history. The position is stored as an int, and reflects //where we are in the history list. wxVector > m_historyList; + wxVector m_factories; int m_historyPosition; bool m_historyLoadingFromList; bool m_historyEnabled; diff --git a/include/wx/webview.h b/include/wx/webview.h index a58fd87f97..662162dfec 100644 --- a/include/wx/webview.h +++ b/include/wx/webview.h @@ -87,6 +87,7 @@ extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewDefaultURLStr[]; class WXDLLIMPEXP_WEBVIEW wxWebView : public wxControl { public: + virtual ~wxWebView() {} virtual bool Create(wxWindow* parent, wxWindowID id, diff --git a/src/msw/webview_ie.cpp b/src/msw/webview_ie.cpp index 8374dc87b8..c118ac6941 100644 --- a/src/msw/webview_ie.cpp +++ b/src/msw/webview_ie.cpp @@ -77,6 +77,13 @@ bool wxWebViewIE::Create(wxWindow* parent, return true; } +wxWebViewIE::~wxWebViewIE() +{ + for(unsigned int i = 0; i < m_factories.size(); i++) + { + m_factories[i]->Release(); + } +} void wxWebViewIE::LoadURL(const wxString& url) { @@ -684,6 +691,7 @@ void wxWebViewIE::RegisterHandler(wxSharedPtr handler) { wxFAIL_MSG("Could not register protocol"); } + m_factories.push_back(cf); } else { -- 2.45.2