]> git.saurik.com Git - wxWidgets.git/commitdiff
if we are not in the main thread, output the assert directly and trap since
authorGilles Depeyrot <gilles_depeyrot@mac.com>
Wed, 9 Apr 2003 20:30:33 +0000 (20:30 +0000)
committerGilles Depeyrot <gilles_depeyrot@mac.com>
Wed, 9 Apr 2003 20:30:33 +0000 (20:30 +0000)
dialogs cannot be displayed

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20114 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/appcmn.cpp

index e22ebf4a3395befa5e3716b9ec0c7cbb847dc1e2..25bda2572b28e387b86e76ed21dd6975ba0d7071 100644 (file)
@@ -548,6 +548,24 @@ void ShowAssertDialog(const wxChar *szFile,
         wxStrcat(szBuf, wxT("."));
     }
 
+#if wxUSE_THREADS
+    // if we are not in the main thread,
+    // output the assert directly and trap since dialogs cannot be displayed
+    if (!wxThread::IsMain()) {
+        wxStrcat(szBuf, wxT(" [in child thread]"));
+#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
+        wxStrcat(szBuf, wxT("\r\n"));
+        OutputDebugString(szBuf);
+#else
+        // send to stderr
+        wxFprintf(stderr, wxT("%s\n"), szBuf);
+        fflush(stderr);
+#endif
+        // He-e-e-e-elp!! we're asserting in a child thread
+        wxTrap();
+    }
+#endif // wxUSE_THREADS
+
     if ( !s_bNoAsserts )
     {
         // send it to the normal log destination