#if defined(__WXMSW__)
#include "wx/msw/wrapwin.h" // includes windows.h for MessageBox()
+ #include "wx/msw/debughlp.h" // includes windows.h for MessageBox()
#endif
#if wxUSE_FONTMAP
#ifdef __WXDEBUG__
#ifdef wxUSE_STACKWALKER
#include "wx/stackwalk.h"
+ #ifdef __WXMSW__
+ #include "wx/msw/debughlp.h"
+ #endif
#endif // wxUSE_STACKWALKER
#endif // __WXDEBUG__
void wxAppConsole::ProcessPendingEvents()
{
+#if wxUSE_THREADS
+ if ( !wxPendingEventsLocker )
+ return;
+#endif
+
// ensure that we're the only thread to modify the pending events list
wxENTER_CRIT_SECT( *wxPendingEventsLocker );
// In ProcessPendingEvents(), new handlers might be add
// and we can safely leave the critical section here.
wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
+
handler->ProcessPendingEvents();
+
wxENTER_CRIT_SECT( *wxPendingEventsLocker );
node = wxPendingEvents->GetFirst();
return false;
}
-// show the assert modal dialog
-static
-void ShowAssertDialog(const wxChar *szFile,
- int nLine,
- const wxChar *szCond,
- const wxChar *szMsg,
- wxAppTraits *traits)
+#if wxUSE_STACKWALKER
+static wxString GetAssertStackTrace()
{
- // this variable can be set to true to suppress "assert failure" messages
- static bool s_bNoAsserts = false;
-
- wxString msg;
- msg.reserve(2048);
-
- // make life easier for people using VC++ IDE by using this format: like
- // this, clicking on the message will take us immediately to the place of
- // the failed assert
- msg.Printf(wxT("%s(%d): assert \"%s\" failed"), szFile, nLine, szCond);
-
- if ( szMsg )
- {
- msg << _T(": ") << szMsg;
- }
- else // no message given
- {
- msg << _T('.');
- }
+ wxString stackTrace;
-#if wxUSE_STACKWALKER
+#if wxUSE_DBGHELP
+ // check that we can get the stack trace before trying to do it
+ if ( !wxDbgHelpDLL::Init() )
+ return stackTrace;
+#endif
+
class StackDump : public wxStackWalker
{
public:
StackDump dump;
dump.Walk(5); // don't show OnAssert() call itself
- wxString stackTrace = dump.GetStackTrace();
+ stackTrace = dump.GetStackTrace();
+
+ // don't show more than maxLines or we could get a dialog too tall to be
+ // shown on screen: 20 should be ok everywhere as even with 15 pixel high
+ // characters it is still only 300 pixels...
+ static const int maxLines = 20;
+ const int count = stackTrace.Freq(wxT('\n'));
+ for ( int i = 0; i < count - maxLines; i++ )
+ stackTrace = stackTrace.BeforeLast(wxT('\n'));
+
+ return stackTrace;
+}
+#endif // wxUSE_STACKWALKER
+
+// show the assert modal dialog
+static
+void ShowAssertDialog(const wxChar *szFile,
+ int nLine,
+ const wxChar *szCond,
+ const wxChar *szMsg,
+ wxAppTraits *traits)
+{
+ // this variable can be set to true to suppress "assert failure" messages
+ static bool s_bNoAsserts = false;
- const int maxLines = 10;
- // Don't show more than maxLines or we could get an enormous dialog
- int count = stackTrace.Freq(wxT('\n'));
- if (count > maxLines)
+ wxString msg;
+ msg.reserve(2048);
+
+ // make life easier for people using VC++ IDE by using this format: like
+ // this, clicking on the message will take us immediately to the place of
+ // the failed assert
+ msg.Printf(wxT("%s(%d): assert \"%s\" failed"), szFile, nLine, szCond);
+
+ if ( szMsg )
+ {
+ msg << _T(": ") << szMsg;
+ }
+ else // no message given
{
- int i;
- for (i = 0; i < count - maxLines; i++)
- stackTrace = stackTrace.BeforeLast(wxT('\n'));
+ msg << _T('.');
}
+
+#if wxUSE_STACKWALKER
+ const wxString stackTrace = GetAssertStackTrace();
if ( !stackTrace.empty() )
{
- msg << _T("\n\nCall stack:\n")
- << stackTrace;
+ msg << _T("\n\nCall stack:\n") << stackTrace;
}
#endif // wxUSE_STACKWALKER