]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed crash in wxHtmlHelpController if the help window is still open
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 13 Mar 2008 23:42:57 +0000 (23:42 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 13 Mar 2008 23:42:57 +0000 (23:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/html/helpfrm.h
src/html/helpctrl.cpp
src/html/helpfrm.cpp
src/html/helpwnd.cpp

index 9916dcb4a7d8a7d16e78ad3d1ae39269403f891f..13816fa3c1d52403ed9bbf8427957b0409ec68b3 100644 (file)
@@ -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; }
index a0c120aa75574e7d54c71508740e274e3887515a..206e868051e9f343791ca42e4b57d08a3e0ec4db 100644 (file)
@@ -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;
index a9983916f7258a737e103ac6937e82a09c0425fa..ea22fa9b6edb0bb7b02e0997d031529795f8c29e 100644 (file)
@@ -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);
     
index 7dc36c785e5e21d445aa5df9141204ed3f94c2a8..778594052f6dc2717def1ee6d9fd920f7a71b62d 100644 (file)
@@ -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!)