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
This commit is contained in:
Steve Lamerton
2011-10-05 17:23:51 +00:00
parent 24fb46ea48
commit 3949871086
3 changed files with 13 additions and 0 deletions

View File

@@ -24,6 +24,7 @@
struct IHTMLDocument2; struct IHTMLDocument2;
class wxFSFile; class wxFSFile;
class ClassFactory;
class WXDLLIMPEXP_WEBVIEW wxWebViewIE : public wxWebView class WXDLLIMPEXP_WEBVIEW wxWebViewIE : public wxWebView
{ {
@@ -42,6 +43,8 @@ public:
Create(parent, id, url, pos, size, style, name); Create(parent, id, url, pos, size, style, name);
} }
~wxWebViewIE();
bool Create(wxWindow* parent, bool Create(wxWindow* parent,
wxWindowID id, wxWindowID id,
const wxString& url = wxWebViewDefaultURLStr, const wxString& url = wxWebViewDefaultURLStr,
@@ -149,6 +152,7 @@ private:
//an item from the history. The position is stored as an int, and reflects //an item from the history. The position is stored as an int, and reflects
//where we are in the history list. //where we are in the history list.
wxVector<wxSharedPtr<wxWebViewHistoryItem> > m_historyList; wxVector<wxSharedPtr<wxWebViewHistoryItem> > m_historyList;
wxVector<ClassFactory*> m_factories;
int m_historyPosition; int m_historyPosition;
bool m_historyLoadingFromList; bool m_historyLoadingFromList;
bool m_historyEnabled; bool m_historyEnabled;

View File

@@ -87,6 +87,7 @@ extern WXDLLIMPEXP_DATA_WEBVIEW(const char) wxWebViewDefaultURLStr[];
class WXDLLIMPEXP_WEBVIEW wxWebView : public wxControl class WXDLLIMPEXP_WEBVIEW wxWebView : public wxControl
{ {
public: public:
virtual ~wxWebView() {}
virtual bool Create(wxWindow* parent, virtual bool Create(wxWindow* parent,
wxWindowID id, wxWindowID id,

View File

@@ -77,6 +77,13 @@ bool wxWebViewIE::Create(wxWindow* parent,
return true; return true;
} }
wxWebViewIE::~wxWebViewIE()
{
for(unsigned int i = 0; i < m_factories.size(); i++)
{
m_factories[i]->Release();
}
}
void wxWebViewIE::LoadURL(const wxString& url) void wxWebViewIE::LoadURL(const wxString& url)
{ {
@@ -684,6 +691,7 @@ void wxWebViewIE::RegisterHandler(wxSharedPtr<wxWebViewHandler> handler)
{ {
wxFAIL_MSG("Could not register protocol"); wxFAIL_MSG("Could not register protocol");
} }
m_factories.push_back(cf);
} }
else else
{ {