X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5526e819eca4465ed5520d49bccfebc6a28045e0..fd128b0c3ab84380d782e45bfa98f181a848df27:/src/html/htmlwin.cpp diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index b0077c8b1a..b98f5fed9a 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -170,8 +170,9 @@ bool wxHtmlWindow::LoadPage(const wxString& location) wxString err; err.Printf(_("The browser is unable to open requested location :\n\n%s"), WXSTRINGCAST location); - wxMessageBox(err, "Error"); m_tmpCanDraw = TRUE; + Refresh(); + wxMessageBox(err, "Error"); return FALSE; } @@ -194,7 +195,10 @@ bool wxHtmlWindow::LoadPage(const wxString& location) } node = node -> GetNext(); } - if (src == wxEmptyString) src = m_DefaultFilter.ReadFile(*f); + if (src == wxEmptyString) { + if (m_DefaultFilter == NULL) m_DefaultFilter = GetDefaultFilter(); + src = m_DefaultFilter -> ReadFile(*f); + } m_FS -> ChangePathTo(f -> GetLocation()); rt_val = SetPage(src); @@ -376,7 +380,15 @@ void wxHtmlWindow::HistoryClear() wxList wxHtmlWindow::m_Filters; -wxHtmlFilterPlainText wxHtmlWindow::m_DefaultFilter; +wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL; + +void wxHtmlWindow::CleanUpStatics() +{ + if (m_DefaultFilter) delete m_DefaultFilter; + m_DefaultFilter = NULL; +} + + void wxHtmlWindow::AddFilter(wxHtmlFilter *filter) { @@ -524,6 +536,21 @@ END_EVENT_TABLE() +// A module to allow initialization/cleanup +// without calling these functions from app.cpp or from +// the user's application. + +class wxHtmlWinModule: public wxModule +{ +DECLARE_DYNAMIC_CLASS(wxHtmlWinModule) +public: + wxHtmlWinModule() : wxModule() {} + bool OnInit() { return TRUE; } + void OnExit() { wxHtmlWindow::CleanUpStatics(); } +}; + +IMPLEMENT_DYNAMIC_CLASS(wxHtmlWinModule, wxModule) + @@ -539,4 +566,4 @@ FORCE_LINK(mod_links) FORCE_LINK(mod_tables) -#endif \ No newline at end of file +#endif