lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [6002] Don't use base class handler for log frame menu


From: Greg Chicares
Subject: [lmi-commits] [6002] Don't use base class handler for log frame menu
Date: Mon, 27 Oct 2014 14:35:33 +0000

Revision: 6002
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6002
Author:   chicares
Date:     2014-10-27 14:35:32 +0000 (Mon, 27 Oct 2014)
Log Message:
-----------
Don't use base class handler for log frame menu

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/main_wx_test.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-10-27 14:34:39 UTC (rev 6001)
+++ lmi/trunk/ChangeLog 2014-10-27 14:35:32 UTC (rev 6002)
@@ -34412,3 +34412,14 @@
 Avoid unnecessary copying. See:
   http://lists.nongnu.org/archive/html/lmi/2014-10/msg00086.html
 
+20141027T1434Z <address@hidden> [532]
+
+  skeleton.cpp
+Prefer not to call safe_message_alert() directly.
+
+20141027T1435Z <address@hidden> [532]
+
+  main_wx_test.cpp
+Don't use base class handler for log frame menu. See:
+  http://lists.nongnu.org/archive/html/lmi/2014-10/msg00086.html
+

Modified: lmi/trunk/main_wx_test.cpp
===================================================================
--- lmi/trunk/main_wx_test.cpp  2014-10-27 14:34:39 UTC (rev 6001)
+++ lmi/trunk/main_wx_test.cpp  2014-10-27 14:35:32 UTC (rev 6002)
@@ -446,6 +446,10 @@
   private:
     void RunTheTests();
 
+    // This event handler only exists to prevent the base class from handling
+    // this event, see the comment near its use.
+    void ConsumeMenuOpen(wxMenuEvent&) {}
+
     std::string runtime_error_;
     bool is_running_tests_;
 };
@@ -610,6 +614,13 @@
     log->GetFrame()->Maximize();
     log->GetFrame()->SetFocus();
     SetExitOnFrameDelete(false);
+
+    // Before closing the main window, ensure that the base class event handler
+    // relying on it being alive is not called any more, otherwise 
dereferencing
+    // the pointer to the main frame inside it would simply crash on any 
attempt
+    // to open the log frame menu.
+    Bind(wxEVT_MENU_OPEN, &SkeletonTest::ConsumeMenuOpen, this);
+
     mainWin->Close();
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]