1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/appbase.cpp
3 // Purpose: implements wxAppConsoleBase class
4 // Author: Vadim Zeitlin
6 // Created: 19.06.2003 (extracted from common/appcmn.cpp)
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
29 #include "wx/msw/wrapwin.h" // includes windows.h for MessageBox()
36 #include "wx/wxcrtvararg.h"
39 #include "wx/apptrait.h"
40 #include "wx/cmdline.h"
41 #include "wx/confbase.h"
42 #include "wx/evtloop.h"
43 #include "wx/filename.h"
44 #include "wx/msgout.h"
45 #include "wx/scopedptr.h"
46 #include "wx/tokenzr.h"
47 #include "wx/thread.h"
49 #if wxUSE_EXCEPTIONS && wxUSE_STL
55 #if !defined(__WXMSW__) || defined(__WXMICROWIN__)
56 #include <signal.h> // for SIGTRAP used by wxTrap()
60 #endif // ! __WXPALMOS5__
63 #include "wx/fontmap.h"
64 #endif // wxUSE_FONTMAP
68 #include "wx/stackwalk.h"
70 #include "wx/msw/debughlp.h"
72 #endif // wxUSE_STACKWALKER
74 #include "wx/recguard.h"
77 // wxABI_VERSION can be defined when compiling applications but it should be
78 // left undefined when compiling the library itself, it is then set to its
79 // default value in version.h
80 #if wxABI_VERSION != wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + 99
81 #error "wxABI_VERSION should not be defined when compiling the library"
84 // ----------------------------------------------------------------------------
85 // private functions prototypes
86 // ----------------------------------------------------------------------------
89 // really just show the assert dialog
90 static bool DoShowAssertDialog(const wxString
& msg
);
92 // prepare for showing the assert dialog, use the given traits or
93 // DoShowAssertDialog() as last fallback to really show it
95 void ShowAssertDialog(const wxString
& szFile
,
97 const wxString
& szFunc
,
98 const wxString
& szCond
,
99 const wxString
& szMsg
,
100 wxAppTraits
*traits
= NULL
);
102 // turn on the trace masks specified in the env variable WXTRACE
103 static void LINKAGEMODE
SetTraceMasks();
104 #endif // __WXDEBUG__
106 // ----------------------------------------------------------------------------
108 // ----------------------------------------------------------------------------
110 wxAppConsole
*wxAppConsoleBase::ms_appInstance
= NULL
;
112 wxAppInitializerFunction
wxAppConsoleBase::ms_appInitFn
= NULL
;
114 wxSocketManager
*wxAppTraitsBase::ms_manager
= NULL
;
116 // ----------------------------------------------------------------------------
118 // ----------------------------------------------------------------------------
120 // this defines wxEventLoopPtr
121 wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoopBase
)
123 // ============================================================================
124 // wxAppConsoleBase implementation
125 // ============================================================================
127 // ----------------------------------------------------------------------------
129 // ----------------------------------------------------------------------------
131 wxAppConsoleBase::wxAppConsoleBase()
136 ms_appInstance
= static_cast<wxAppConsole
*>(this);
141 // In unicode mode the SetTraceMasks call can cause an apptraits to be
142 // created, but since we are still in the constructor the wrong kind will
143 // be created for GUI apps. Destroy it so it can be created again later.
150 wxAppConsoleBase::~wxAppConsoleBase()
155 // ----------------------------------------------------------------------------
156 // initilization/cleanup
157 // ----------------------------------------------------------------------------
159 bool wxAppConsoleBase::Initialize(int& WXUNUSED(argc
), wxChar
**argv
)
162 GetTraits()->SetLocale();
166 wxHandlersWithPendingEventsLocker
= new wxCriticalSection
;
167 wxHandlersWithPendingDelayedEvents
= new wxList
;
171 if ( m_appName
.empty() && argv
&& argv
[0] )
173 // the application name is, by default, the name of its executable file
174 wxFileName::SplitPath(argv
[0], NULL
, &m_appName
, NULL
);
176 #endif // !__WXPALMOS__
181 wxEventLoopBase
*wxAppConsoleBase::CreateMainLoop()
183 return GetTraits()->CreateEventLoop();
186 void wxAppConsoleBase::CleanUp()
194 delete wxHandlersWithPendingEvents
;
195 wxHandlersWithPendingEvents
= NULL
;
197 delete wxHandlersWithPendingDelayedEvents
;
198 wxHandlersWithPendingDelayedEvents
= NULL
;
201 delete wxHandlersWithPendingEventsLocker
;
202 wxHandlersWithPendingEventsLocker
= NULL
;
203 #endif // wxUSE_THREADS
206 // ----------------------------------------------------------------------------
208 // ----------------------------------------------------------------------------
210 bool wxAppConsoleBase::OnInit()
212 #if wxUSE_CMDLINE_PARSER
213 wxCmdLineParser
parser(argc
, argv
);
215 OnInitCmdLine(parser
);
218 switch ( parser
.Parse(false /* don't show usage */) )
221 cont
= OnCmdLineHelp(parser
);
225 cont
= OnCmdLineParsed(parser
);
229 cont
= OnCmdLineError(parser
);
235 #endif // wxUSE_CMDLINE_PARSER
240 int wxAppConsoleBase::OnRun()
245 int wxAppConsoleBase::OnExit()
248 // delete the config object if any (don't use Get() here, but Set()
249 // because Get() could create a new config object)
250 delete wxConfigBase::Set(NULL
);
251 #endif // wxUSE_CONFIG
256 void wxAppConsoleBase::Exit()
258 if (m_mainLoop
!= NULL
)
264 // ----------------------------------------------------------------------------
266 // ----------------------------------------------------------------------------
268 wxAppTraits
*wxAppConsoleBase::CreateTraits()
270 return new wxConsoleAppTraits
;
273 wxAppTraits
*wxAppConsoleBase::GetTraits()
275 // FIXME-MT: protect this with a CS?
278 m_traits
= CreateTraits();
280 wxASSERT_MSG( m_traits
, _T("wxApp::CreateTraits() failed?") );
287 wxAppTraits
*wxAppConsoleBase::GetTraitsIfExists()
289 wxAppConsole
* const app
= GetInstance();
290 return app
? app
->GetTraits() : NULL
;
293 // ----------------------------------------------------------------------------
295 // ----------------------------------------------------------------------------
297 int wxAppConsoleBase::MainLoop()
299 wxEventLoopBaseTiedPtr
mainLoop(&m_mainLoop
, CreateMainLoop());
301 return m_mainLoop
? m_mainLoop
->Run() : -1;
304 void wxAppConsoleBase::ExitMainLoop()
306 // we should exit from the main event loop, not just any currently active
307 // (e.g. modal dialog) event loop
308 if ( m_mainLoop
&& m_mainLoop
->IsRunning() )
314 bool wxAppConsoleBase::Pending()
316 // use the currently active message loop here, not m_mainLoop, because if
317 // we're showing a modal dialog (with its own event loop) currently the
318 // main event loop is not running anyhow
319 wxEventLoopBase
* const loop
= wxEventLoopBase::GetActive();
321 return loop
&& loop
->Pending();
324 bool wxAppConsoleBase::Dispatch()
326 // see comment in Pending()
327 wxEventLoopBase
* const loop
= wxEventLoopBase::GetActive();
329 return loop
&& loop
->Dispatch();
332 bool wxAppConsoleBase::HasPendingEvents() const
334 wxENTER_CRIT_SECT( *wxHandlersWithPendingEventsLocker
);
336 bool has
= wxHandlersWithPendingEvents
&& !wxHandlersWithPendingEvents
->IsEmpty();
338 wxLEAVE_CRIT_SECT( *wxHandlersWithPendingEventsLocker
);
343 void wxAppConsoleBase::SuspendProcessingOfPendingEvents()
345 wxENTER_CRIT_SECT( *wxHandlersWithPendingEventsLocker
);
348 void wxAppConsoleBase::ResumeProcessingOfPendingEvents()
350 wxLEAVE_CRIT_SECT( *wxHandlersWithPendingEventsLocker
);
354 bool wxAppConsoleBase::IsMainLoopRunning()
356 const wxAppConsole
* const app
= GetInstance();
358 return app
&& app
->m_mainLoop
!= NULL
;
361 void wxAppConsoleBase::ProcessPendingEvents()
364 if ( !wxHandlersWithPendingEventsLocker
)
368 wxENTER_CRIT_SECT( *wxHandlersWithPendingEventsLocker
);
370 wxCHECK_RET( wxHandlersWithPendingDelayedEvents
->IsEmpty(),
371 "this helper list should be empty" );
373 if (wxHandlersWithPendingEvents
)
375 // iterate until the list becomes empty: the handlers remove themselves
376 // from it when they don't have any more pending events
377 wxList::compatibility_iterator node
= wxHandlersWithPendingEvents
->GetFirst();
380 // In ProcessPendingEvents(), new handlers might be added
381 // and we can safely leave the critical section here.
382 wxLEAVE_CRIT_SECT( *wxHandlersWithPendingEventsLocker
);
384 wxEvtHandler
*handler
= (wxEvtHandler
*)node
->GetData();
385 handler
->ProcessPendingEvents();
387 wxENTER_CRIT_SECT( *wxHandlersWithPendingEventsLocker
);
389 // restart as the iterators could have been invalidated
390 node
= wxHandlersWithPendingEvents
->GetFirst();
394 // now the wxHandlersWithPendingEvents is surely empty; however some event
395 // handlers may have moved themselves into wxHandlersWithPendingDelayedEvents
396 // because of a selective wxYield call in progress.
397 // Now we need to move them back to wxHandlersWithPendingEvents so the next
398 // call to this function has the chance of processing them:
399 if (!wxHandlersWithPendingDelayedEvents
->IsEmpty())
401 if (!wxHandlersWithPendingEvents
)
402 wxHandlersWithPendingEvents
= new wxList
;
404 WX_APPEND_LIST(wxHandlersWithPendingEvents
, wxHandlersWithPendingDelayedEvents
);
405 wxHandlersWithPendingDelayedEvents
->Clear();
408 wxLEAVE_CRIT_SECT( *wxHandlersWithPendingEventsLocker
);
411 void wxAppConsoleBase::WakeUpIdle()
414 m_mainLoop
->WakeUp();
417 bool wxAppConsoleBase::ProcessIdle()
419 // process pending wx events before sending idle events
420 ProcessPendingEvents();
424 event
.SetEventObject(this);
426 return event
.MoreRequested();
429 int wxAppConsoleBase::FilterEvent(wxEvent
& WXUNUSED(event
))
431 // process the events normally by default
435 // ----------------------------------------------------------------------------
436 // exception handling
437 // ----------------------------------------------------------------------------
442 wxAppConsoleBase::HandleEvent(wxEvtHandler
*handler
,
443 wxEventFunction func
,
444 wxEvent
& event
) const
446 // by default, simply call the handler
447 (handler
->*func
)(event
);
450 void wxAppConsoleBase::CallEventHandler(wxEvtHandler
*handler
,
451 wxEventFunctor
& functor
,
452 wxEvent
& event
) const
454 // If the functor holds a method then, for backward compatibility, call
456 wxEventFunction eventFunction
= functor
.GetMethod();
459 HandleEvent(handler
, eventFunction
, event
);
461 functor(handler
, event
);
464 void wxAppConsoleBase::OnUnhandledException()
467 // we're called from an exception handler so we can re-throw the exception
468 // to recover its type
475 catch ( std::exception
& e
)
477 what
.Printf("std::exception of type \"%s\", what() = \"%s\"",
478 typeid(e
).name(), e
.what());
483 what
= "unknown exception";
486 wxMessageOutputBest().Printf(
487 "*** Caught unhandled %s; terminating\n", what
489 #endif // __WXDEBUG__
492 // ----------------------------------------------------------------------------
493 // exceptions support
494 // ----------------------------------------------------------------------------
496 bool wxAppConsoleBase::OnExceptionInMainLoop()
500 // some compilers are too stupid to know that we never return after throw
501 #if defined(__DMC__) || (defined(_MSC_VER) && _MSC_VER < 1200)
506 #endif // wxUSE_EXCEPTIONS
508 // ----------------------------------------------------------------------------
510 // ----------------------------------------------------------------------------
512 #if wxUSE_CMDLINE_PARSER
514 #define OPTION_VERBOSE "verbose"
516 void wxAppConsoleBase::OnInitCmdLine(wxCmdLineParser
& parser
)
518 // the standard command line options
519 static const wxCmdLineEntryDesc cmdLineDesc
[] =
525 gettext_noop("show this help message"),
527 wxCMD_LINE_OPTION_HELP
535 gettext_noop("generate verbose log messages"),
545 parser
.SetDesc(cmdLineDesc
);
548 bool wxAppConsoleBase::OnCmdLineParsed(wxCmdLineParser
& parser
)
551 if ( parser
.Found(OPTION_VERBOSE
) )
553 wxLog::SetVerbose(true);
562 bool wxAppConsoleBase::OnCmdLineHelp(wxCmdLineParser
& parser
)
569 bool wxAppConsoleBase::OnCmdLineError(wxCmdLineParser
& parser
)
576 #endif // wxUSE_CMDLINE_PARSER
578 // ----------------------------------------------------------------------------
580 // ----------------------------------------------------------------------------
583 bool wxAppConsoleBase::CheckBuildOptions(const char *optionsSignature
,
584 const char *componentName
)
586 #if 0 // can't use wxLogTrace, not up and running yet
587 printf("checking build options object '%s' (ptr %p) in '%s'\n",
588 optionsSignature
, optionsSignature
, componentName
);
591 if ( strcmp(optionsSignature
, WX_BUILD_OPTIONS_SIGNATURE
) != 0 )
593 wxString lib
= wxString::FromAscii(WX_BUILD_OPTIONS_SIGNATURE
);
594 wxString prog
= wxString::FromAscii(optionsSignature
);
595 wxString progName
= wxString::FromAscii(componentName
);
598 msg
.Printf(_T("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."),
599 lib
.c_str(), progName
.c_str(), prog
.c_str());
601 wxLogFatalError(msg
.c_str());
603 // normally wxLogFatalError doesn't return
613 void wxAppConsoleBase::OnAssertFailure(const wxChar
*file
,
619 ShowAssertDialog(file
, line
, func
, cond
, msg
, GetTraits());
622 void wxAppConsoleBase::OnAssert(const wxChar
*file
,
627 OnAssertFailure(file
, line
, NULL
, cond
, msg
);
630 #endif // __WXDEBUG__
632 // ============================================================================
633 // other classes implementations
634 // ============================================================================
636 // ----------------------------------------------------------------------------
637 // wxConsoleAppTraitsBase
638 // ----------------------------------------------------------------------------
642 wxLog
*wxConsoleAppTraitsBase::CreateLogTarget()
644 return new wxLogStderr
;
649 wxMessageOutput
*wxConsoleAppTraitsBase::CreateMessageOutput()
651 return new wxMessageOutputStderr
;
656 wxFontMapper
*wxConsoleAppTraitsBase::CreateFontMapper()
658 return (wxFontMapper
*)new wxFontMapperBase
;
661 #endif // wxUSE_FONTMAP
663 wxRendererNative
*wxConsoleAppTraitsBase::CreateRenderer()
665 // console applications don't use renderers
670 bool wxConsoleAppTraitsBase::ShowAssertDialog(const wxString
& msg
)
672 return wxAppTraitsBase::ShowAssertDialog(msg
);
676 bool wxConsoleAppTraitsBase::HasStderr()
678 // console applications always have stderr, even under Mac/Windows
682 void wxConsoleAppTraitsBase::ScheduleForDestroy(wxObject
*object
)
687 void wxConsoleAppTraitsBase::RemoveFromPendingDelete(wxObject
* WXUNUSED(object
))
692 // ----------------------------------------------------------------------------
694 // ----------------------------------------------------------------------------
697 void wxAppTraitsBase::SetLocale()
699 wxSetlocale(LC_ALL
, "");
700 wxUpdateLocaleIsUtf8();
705 void wxMutexGuiEnterImpl();
706 void wxMutexGuiLeaveImpl();
708 void wxAppTraitsBase::MutexGuiEnter()
710 wxMutexGuiEnterImpl();
713 void wxAppTraitsBase::MutexGuiLeave()
715 wxMutexGuiLeaveImpl();
718 void WXDLLIMPEXP_BASE
wxMutexGuiEnter()
720 wxAppTraits
* const traits
= wxAppConsoleBase::GetTraitsIfExists();
722 traits
->MutexGuiEnter();
725 void WXDLLIMPEXP_BASE
wxMutexGuiLeave()
727 wxAppTraits
* const traits
= wxAppConsoleBase::GetTraitsIfExists();
729 traits
->MutexGuiLeave();
731 #endif // wxUSE_THREADS
735 bool wxAppTraitsBase::ShowAssertDialog(const wxString
& msgOriginal
)
737 wxString msg
= msgOriginal
;
739 #if wxUSE_STACKWALKER
740 #if !defined(__WXMSW__)
741 // on Unix stack frame generation may take some time, depending on the
742 // size of the executable mainly... warn the user that we are working
743 wxFprintf(stderr
, wxT("[Debug] Generating a stack trace... please wait"));
747 const wxString stackTrace
= GetAssertStackTrace();
748 if ( !stackTrace
.empty() )
749 msg
<< _T("\n\nCall stack:\n") << stackTrace
;
750 #endif // wxUSE_STACKWALKER
752 return DoShowAssertDialog(msg
);
755 #if wxUSE_STACKWALKER
756 wxString
wxAppTraitsBase::GetAssertStackTrace()
760 class StackDump
: public wxStackWalker
765 const wxString
& GetStackTrace() const { return m_stackTrace
; }
768 virtual void OnStackFrame(const wxStackFrame
& frame
)
770 m_stackTrace
<< wxString::Format
773 wx_truncate_cast(int, frame
.GetLevel())
776 wxString name
= frame
.GetName();
779 m_stackTrace
<< wxString::Format(_T("%-40s"), name
.c_str());
783 m_stackTrace
<< wxString::Format(_T("%p"), frame
.GetAddress());
786 if ( frame
.HasSourceLocation() )
788 m_stackTrace
<< _T('\t')
789 << frame
.GetFileName()
794 m_stackTrace
<< _T('\n');
798 wxString m_stackTrace
;
801 // don't show more than maxLines or we could get a dialog too tall to be
802 // shown on screen: 20 should be ok everywhere as even with 15 pixel high
803 // characters it is still only 300 pixels...
804 static const int maxLines
= 20;
807 dump
.Walk(2, maxLines
); // don't show OnAssert() call itself
808 stackTrace
= dump
.GetStackTrace();
810 const int count
= stackTrace
.Freq(wxT('\n'));
811 for ( int i
= 0; i
< count
- maxLines
; i
++ )
812 stackTrace
= stackTrace
.BeforeLast(wxT('\n'));
816 #endif // wxUSE_STACKWALKER
819 #endif // __WXDEBUG__
821 // ============================================================================
822 // global functions implementation
823 // ============================================================================
833 // what else can we do?
842 wxTheApp
->WakeUpIdle();
844 //else: do nothing, what can we do?
850 bool wxAssertIsEqual(int x
, int y
)
855 // break into the debugger
858 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
860 #elif defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS
862 #elif defined(__UNIX__)
869 // this function is called when an assert fails
870 static void wxDoOnAssert(const wxString
& szFile
,
872 const wxString
& szFunc
,
873 const wxString
& szCond
,
874 const wxString
& szMsg
= wxEmptyString
)
877 static int s_bInAssert
= 0;
879 wxRecursionGuard
guard(s_bInAssert
);
880 if ( guard
.IsInside() )
882 // can't use assert here to avoid infinite loops, so just trap
890 // by default, show the assert dialog box -- we can't customize this
892 ShowAssertDialog(szFile
, nLine
, szFunc
, szCond
, szMsg
);
896 // let the app process it as it wants
897 // FIXME-UTF8: use wc_str(), not c_str(), when ANSI build is removed
898 wxTheApp
->OnAssertFailure(szFile
.c_str(), nLine
, szFunc
.c_str(),
899 szCond
.c_str(), szMsg
.c_str());
903 void wxOnAssert(const wxString
& szFile
,
905 const wxString
& szFunc
,
906 const wxString
& szCond
,
907 const wxString
& szMsg
)
909 wxDoOnAssert(szFile
, nLine
, szFunc
, szCond
, szMsg
);
912 void wxOnAssert(const wxString
& szFile
,
914 const wxString
& szFunc
,
915 const wxString
& szCond
)
917 wxDoOnAssert(szFile
, nLine
, szFunc
, szCond
);
920 void wxOnAssert(const wxChar
*szFile
,
923 const wxChar
*szCond
,
926 wxDoOnAssert(szFile
, nLine
, szFunc
, szCond
, szMsg
);
929 void wxOnAssert(const char *szFile
,
933 const wxString
& szMsg
)
935 wxDoOnAssert(szFile
, nLine
, szFunc
, szCond
, szMsg
);
938 void wxOnAssert(const char *szFile
,
942 const wxCStrData
& msg
)
944 wxDoOnAssert(szFile
, nLine
, szFunc
, szCond
, msg
);
948 void wxOnAssert(const char *szFile
,
953 wxDoOnAssert(szFile
, nLine
, szFunc
, szCond
);
956 void wxOnAssert(const char *szFile
,
962 wxDoOnAssert(szFile
, nLine
, szFunc
, szCond
, szMsg
);
965 void wxOnAssert(const char *szFile
,
971 wxDoOnAssert(szFile
, nLine
, szFunc
, szCond
, szMsg
);
973 #endif // wxUSE_UNICODE
975 #endif // __WXDEBUG__
977 // ============================================================================
978 // private functions implementation
979 // ============================================================================
983 static void LINKAGEMODE
SetTraceMasks()
987 if ( wxGetEnv(wxT("WXTRACE"), &mask
) )
989 wxStringTokenizer
tkn(mask
, wxT(",;:"));
990 while ( tkn
.HasMoreTokens() )
991 wxLog::AddTraceMask(tkn
.GetNextToken());
997 bool DoShowAssertDialog(const wxString
& msg
)
999 // under MSW we can show the dialog even in the console mode
1000 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
1001 wxString
msgDlg(msg
);
1003 // this message is intentionally not translated -- it is for
1005 msgDlg
+= wxT("\nDo you want to stop the program?\n")
1006 wxT("You can also choose [Cancel] to suppress ")
1007 wxT("further warnings.");
1009 switch ( ::MessageBox(NULL
, msgDlg
.wx_str(), _T("wxWidgets Debug Alert"),
1010 MB_YESNOCANCEL
| MB_ICONSTOP
) )
1020 //case IDNO: nothing to do
1023 wxFprintf(stderr
, wxT("%s\n"), msg
.c_str());
1026 // TODO: ask the user to enter "Y" or "N" on the console?
1028 #endif // __WXMSW__/!__WXMSW__
1030 // continue with the asserts
1034 // show the assert modal dialog
1036 void ShowAssertDialog(const wxString
& szFile
,
1038 const wxString
& szFunc
,
1039 const wxString
& szCond
,
1040 const wxString
& szMsg
,
1041 wxAppTraits
*traits
)
1043 // this variable can be set to true to suppress "assert failure" messages
1044 static bool s_bNoAsserts
= false;
1049 // make life easier for people using VC++ IDE by using this format: like
1050 // this, clicking on the message will take us immediately to the place of
1051 // the failed assert
1052 msg
.Printf(wxT("%s(%d): assert \"%s\" failed"), szFile
, nLine
, szCond
);
1054 // add the function name, if any
1055 if ( !szFunc
.empty() )
1056 msg
<< _T(" in ") << szFunc
<< _T("()");
1058 // and the message itself
1059 if ( !szMsg
.empty() )
1061 msg
<< _T(": ") << szMsg
;
1063 else // no message given
1069 // if we are not in the main thread, output the assert directly and trap
1070 // since dialogs cannot be displayed
1071 if ( !wxThread::IsMain() )
1073 msg
+= wxT(" [in child thread]");
1075 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
1077 OutputDebugString(msg
.wx_str());
1080 wxFprintf(stderr
, wxT("%s\n"), msg
.c_str());
1083 // He-e-e-e-elp!! we're asserting in a child thread
1087 #endif // wxUSE_THREADS
1089 if ( !s_bNoAsserts
)
1091 // send it to the normal log destination
1092 wxLogDebug(_T("%s"), msg
.c_str());
1096 // delegate showing assert dialog (if possible) to that class
1097 s_bNoAsserts
= traits
->ShowAssertDialog(msg
);
1099 else // no traits object
1101 // fall back to the function of last resort
1102 s_bNoAsserts
= DoShowAssertDialog(msg
);
1107 #endif // __WXDEBUG__