From 664d1729475f53f353e8ba02aef052129d701aca Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 13 Mar 2008 23:42:57 +0000 Subject: [PATCH] fixed crash in wxHtmlHelpController if the help window is still open git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/html/helpfrm.h | 2 +- src/html/helpctrl.cpp | 5 +++-- src/html/helpfrm.cpp | 8 ++++++++ src/html/helpwnd.cpp | 3 +++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/wx/html/helpfrm.h b/include/wx/html/helpfrm.h index 9916dcb4a7..13816fa3c1 100644 --- a/include/wx/html/helpfrm.h +++ b/include/wx/html/helpfrm.h @@ -88,7 +88,7 @@ public: wxHtmlHelpController* GetController() const { return m_helpController; } /// Sets the help controller associated with the window. - void SetController(wxHtmlHelpController* controller) { m_helpController = controller; } + void SetController(wxHtmlHelpController* controller); /// Returns the help window. wxHtmlHelpWindow* GetHelpWindow() const { return m_HtmlHelpWin; } diff --git a/src/html/helpctrl.cpp b/src/html/helpctrl.cpp index a0c120aa75..206e868051 100644 --- a/src/html/helpctrl.cpp +++ b/src/html/helpctrl.cpp @@ -87,12 +87,13 @@ void wxHtmlHelpController::OnCloseFrame(wxCloseEvent& evt) { if (m_Config) WriteCustomization(m_Config, m_ConfigRoot); - + evt.Skip(); OnQuit(); - m_helpWindow->SetController(NULL); + if ( m_helpWindow ) + m_helpWindow->SetController(NULL); m_helpWindow = NULL; m_helpDialog = NULL; m_helpFrame = NULL; diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index a9983916f7..ea22fa9b6e 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -85,12 +85,20 @@ void wxHtmlHelpFrame::Init(wxHtmlHelpData* data) m_helpController = (wxHtmlHelpController*) NULL; } +void wxHtmlHelpFrame::SetController(wxHtmlHelpController* controller) +{ + m_helpController = controller; + if ( m_HtmlHelpWin ) + m_HtmlHelpWin->SetController(controller); +} + // Create: builds the GUI components. bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& WXUNUSED(title), int style, wxConfigBase *config, const wxString& rootpath) { m_HtmlHelpWin = new wxHtmlHelpWindow(m_Data); + m_HtmlHelpWin->SetController(m_helpController); if ( config) m_HtmlHelpWin->UseConfig(config, rootpath); diff --git a/src/html/helpwnd.cpp b/src/html/helpwnd.cpp index 7dc36c785e..778594052f 100644 --- a/src/html/helpwnd.cpp +++ b/src/html/helpwnd.cpp @@ -592,6 +592,9 @@ bool wxHtmlHelpWindow::Create(wxWindow* parent, wxWindowID id, wxHtmlHelpWindow::~wxHtmlHelpWindow() { + if ( m_helpController ) + m_helpController->SetHelpWindow(NULL); + delete m_mergedIndex; // PopEventHandler(); // wxhtmlhelpcontroller (not any more!) -- 2.45.2