lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5998] Override OnAssertFailure()


From: Greg Chicares
Subject: [lmi-commits] [5998] Override OnAssertFailure()
Date: Sun, 26 Oct 2014 01:04:20 +0000

Revision: 5998
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5998
Author:   chicares
Date:     2014-10-26 01:04:19 +0000 (Sun, 26 Oct 2014)
Log Message:
-----------
Override OnAssertFailure()

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/install_wx.make
    lmi/trunk/skeleton.cpp
    lmi/trunk/skeleton.hpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-10-25 15:34:20 UTC (rev 5997)
+++ lmi/trunk/ChangeLog 2014-10-26 01:04:19 UTC (rev 5998)
@@ -34385,3 +34385,16 @@
 Close "Help | About" dialog if initially open. See:
   http://lists.nongnu.org/archive/html/lmi/2014-10/msg00059.html
 
+20141025T1534Z <address@hidden> [533]
+
+  Makefile.am
+  skeleton.hpp
+Alphabetize where there's no more compelling order.
+
+20141026T0104Z <address@hidden> [533]
+
+  install_wx.make
+  skeleton.cpp
+  skeleton.hpp
+Override OnAssertFailure().
+

Modified: lmi/trunk/install_wx.make
===================================================================
--- lmi/trunk/install_wx.make   2014-10-25 15:34:20 UTC (rev 5997)
+++ lmi/trunk/install_wx.make   2014-10-26 01:04:19 UTC (rev 5998)
@@ -66,10 +66,6 @@
 
 # Configuration reference:
 #   http://lists.nongnu.org/archive/html/lmi/2007-11/msg00001.html
-# SOMEDAY !! But see the last paragraph of
-#   http://lists.nongnu.org/archive/html/lmi/2007-11/msg00004.html
-# and override wxApp::OnAssertFailure() before experimenting with
-# '--enable-debug_flag'.
 #
 # Pass gcc options in $CC and $CXX, not $*FLAGS--explanation here:
 #   http://lists.nongnu.org/archive/html/lmi/2013-07/msg00001.html

Modified: lmi/trunk/skeleton.cpp
===================================================================
--- lmi/trunk/skeleton.cpp      2014-10-25 15:34:20 UTC (rev 5997)
+++ lmi/trunk/skeleton.cpp      2014-10-26 01:04:19 UTC (rev 5998)
@@ -102,6 +102,7 @@
 #include <wx/xrc/xmlres.h>
 
 #include <iterator>
+#include <sstream>
 #include <stdexcept>
 #include <string>
 
@@ -527,6 +528,38 @@
     fenv_validate(e_fenv_indulge_0x027f);
 }
 
+/// Handle wx assertion failure.
+///
+/// By default, wx displays a "Do you want to stop the program?"
+/// messagebox, with MB_YESNOCANCEL buttons. The first choice traps to
+/// a debugger; end users who pick it will be startled by the ensuing
+/// behavior. This overriding implementation essentially forces the
+/// choice "No", which lets the program attempt to continue.
+///
+/// Ignore the 'func' argument: it is superfluous.
+///
+/// Ignore the 'msg' argument iff it represents an empty string.
+
+void Skeleton::OnAssertFailure
+    (wxChar const* file
+    ,int           line
+    ,wxChar const* // func
+    ,wxChar const* cond
+    ,wxChar const* msg
+    )
+{
+    wxString m(msg);
+    if(!m.IsEmpty()) {m = "\n(" + m + ")";}
+    std::ostringstream oss;
+    oss
+        << "Assertion '" << wxString(cond) << "' failed"
+        <<                           m     << "."
+        << "\n[file "    << wxString(file)
+        << ", line "     <<          line  << "]\n"
+        ;
+    safe_message_alert(oss.str().c_str());
+}
+
 /// Rethrow an exception caught by wx into a local catch clause.
 ///
 /// Report the exception, then return 'true' to continue processing.

Modified: lmi/trunk/skeleton.hpp
===================================================================
--- lmi/trunk/skeleton.hpp      2014-10-25 15:34:20 UTC (rev 5997)
+++ lmi/trunk/skeleton.hpp      2014-10-26 01:04:19 UTC (rev 5998)
@@ -63,6 +63,13 @@
 
   protected:
     // wxApp overrides that are further overridden in gui test.
+    virtual void OnAssertFailure
+        (wxChar const* file
+        ,int           line
+        ,wxChar const* func
+        ,wxChar const* cond
+        ,wxChar const* msg
+        );
     virtual bool OnExceptionInMainLoop ();
     virtual bool OnInit                ();
 




reply via email to

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