]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/appbase.cpp
Correct gridlines drawing
[wxWidgets.git] / src / common / appbase.cpp
index 9f3be56cc8f7b1d6b20b016b1804c939fb576074..119622bb8b164ae5d9c9fae44617dd027ffc0456 100644 (file)
 #include "wx/ptr_scpd.h"
 #include "wx/tokenzr.h"
 
+#if wxUSE_EXCEPTIONS && wxUSE_STL
+    #include <exception>
+    #include <typeinfo>
+#endif
+
 #if !defined(__WXMSW__) || defined(__WXMICROWIN__)
   #include  <signal.h>      // for SIGTRAP used by wxTrap()
 #endif  //Win/Unix
@@ -414,12 +419,38 @@ wxAppConsoleBase::HandleEvent(wxEvtHandler *handler,
     (handler->*func)(event);
 }
 
+void wxAppConsoleBase::OnUnhandledException()
+{
+#ifdef __WXDEBUG__
+    // we're called from an exception handler so we can re-throw the exception
+    // to recover its type
+    wxString what;
+    try
+    {
+        throw;
+    }
+#if wxUSE_STL
+    catch ( std::exception& e )
+    {
+        what.Printf("std::exception of type \"%s\", what() = \"%s\"",
+                    typeid(e).name(), e.what());
+    }
+#endif // wxUSE_STL
+    catch ( ... )
+    {
+        what = "unknown exception";
+    }
+
+    wxMessageOutputBest().Printf(
+        "*** Caught unhandled %s; terminating\n", what
+    );
+#endif // __WXDEBUG__
+}
+
 // ----------------------------------------------------------------------------
 // exceptions support
 // ----------------------------------------------------------------------------
 
-#if wxUSE_EXCEPTIONS
-
 bool wxAppConsoleBase::OnExceptionInMainLoop()
 {
     throw;
@@ -430,9 +461,6 @@ bool wxAppConsoleBase::OnExceptionInMainLoop()
 #endif
 }
 
-#endif // wxUSE_EXCEPTIONS
-
-
 #endif // wxUSE_EXCEPTIONS
 
 // ----------------------------------------------------------------------------
@@ -931,7 +959,7 @@ bool DoShowAssertDialog(const wxString& msg)
               wxT("You can also choose [Cancel] to suppress ")
               wxT("further warnings.");
 
-    switch ( ::MessageBox(NULL, msgDlg, _T("wxWidgets Debug Alert"),
+    switch ( ::MessageBox(NULL, msgDlg.wx_str(), _T("wxWidgets Debug Alert"),
                           MB_YESNOCANCEL | MB_ICONSTOP ) )
     {
         case IDYES:
@@ -999,7 +1027,7 @@ void ShowAssertDialog(const wxString& szFile,
 
 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
         msg << wxT("\r\n");
-        OutputDebugString(msg );
+        OutputDebugString(msg.wx_str());
 #else
         // send to stderr
         wxFprintf(stderr, wxT("%s\n"), msg.c_str());