merge of RTL changes (with many modifications) from SOC2006_RTL branch
[wxWidgets.git] / src / common / appbase.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/appbase.cpp
3 // Purpose: implements wxAppConsole class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 19.06.2003 (extracted from common/appcmn.cpp)
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #ifndef WX_PRECOMP
28 #include "wx/list.h"
29 #include "wx/app.h"
30 #include "wx/intl.h"
31 #include "wx/log.h"
32 #include "wx/utils.h"
33 #endif //WX_PRECOMP
34
35 #include "wx/apptrait.h"
36 #include "wx/cmdline.h"
37 #include "wx/confbase.h"
38 #include "wx/filename.h"
39 #include "wx/msgout.h"
40 #include "wx/tokenzr.h"
41
42 #if !defined(__WXMSW__) || defined(__WXMICROWIN__)
43 #include <signal.h> // for SIGTRAP used by wxTrap()
44 #endif //Win/Unix
45
46 #if defined(__WXMSW__)
47 #include "wx/msw/wrapwin.h" // includes windows.h for MessageBox()
48 #endif
49
50 #if wxUSE_FONTMAP
51 #include "wx/fontmap.h"
52 #endif // wxUSE_FONTMAP
53
54 #if defined(__DARWIN__) && defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS
55 // For MacTypes.h for Debugger function
56 #include <CoreFoundation/CFBase.h>
57 #endif
58
59 #if defined(__WXMAC__)
60 #ifdef __DARWIN__
61 #include <CoreServices/CoreServices.h>
62 #else
63 #include "wx/mac/private.h" // includes mac headers
64 #endif
65 #endif // __WXMAC__
66
67 #ifdef __WXDEBUG__
68 #if wxUSE_STACKWALKER
69 #include "wx/stackwalk.h"
70 #ifdef __WXMSW__
71 #include "wx/msw/debughlp.h"
72 #endif
73 #endif // wxUSE_STACKWALKER
74 #endif // __WXDEBUG__
75
76 // wxABI_VERSION can be defined when compiling applications but it should be
77 // left undefined when compiling the library itself, it is then set to its
78 // default value in version.h
79 #if wxABI_VERSION != wxMAJOR_VERSION * 10000 + wxMINOR_VERSION * 100 + 99
80 #error "wxABI_VERSION should not be defined when compiling the library"
81 #endif
82
83 // ----------------------------------------------------------------------------
84 // private functions prototypes
85 // ----------------------------------------------------------------------------
86
87 #ifdef __WXDEBUG__
88 // really just show the assert dialog
89 static bool DoShowAssertDialog(const wxString& msg);
90
91 // prepare for showing the assert dialog, use the given traits or
92 // DoShowAssertDialog() as last fallback to really show it
93 static
94 void ShowAssertDialog(const wxChar *szFile,
95 int nLine,
96 const wxChar *szFunc,
97 const wxChar *szCond,
98 const wxChar *szMsg,
99 wxAppTraits *traits = NULL);
100
101 // turn on the trace masks specified in the env variable WXTRACE
102 static void LINKAGEMODE SetTraceMasks();
103 #endif // __WXDEBUG__
104
105 // ----------------------------------------------------------------------------
106 // global vars
107 // ----------------------------------------------------------------------------
108
109 wxAppConsole *wxAppConsole::ms_appInstance = NULL;
110
111 wxAppInitializerFunction wxAppConsole::ms_appInitFn = NULL;
112
113 // ============================================================================
114 // wxAppConsole implementation
115 // ============================================================================
116
117 // ----------------------------------------------------------------------------
118 // ctor/dtor
119 // ----------------------------------------------------------------------------
120
121 wxAppConsole::wxAppConsole()
122 {
123 m_traits = NULL;
124
125 ms_appInstance = this;
126
127 #ifdef __WXDEBUG__
128 SetTraceMasks();
129 #if wxUSE_UNICODE
130 // In unicode mode the SetTraceMasks call can cause an apptraits to be
131 // created, but since we are still in the constructor the wrong kind will
132 // be created for GUI apps. Destroy it so it can be created again later.
133 delete m_traits;
134 m_traits = NULL;
135 #endif
136 #endif
137 }
138
139 wxAppConsole::~wxAppConsole()
140 {
141 delete m_traits;
142 }
143
144 // ----------------------------------------------------------------------------
145 // initilization/cleanup
146 // ----------------------------------------------------------------------------
147
148 bool wxAppConsole::Initialize(int& argcOrig, wxChar **argvOrig)
149 {
150 // remember the command line arguments
151 argc = argcOrig;
152 argv = argvOrig;
153
154 #ifndef __WXPALMOS__
155 if ( m_appName.empty() && argv )
156 {
157 // the application name is, by default, the name of its executable file
158 wxFileName::SplitPath(argv[0], NULL, &m_appName, NULL);
159 }
160 #endif
161
162 return true;
163 }
164
165 void wxAppConsole::CleanUp()
166 {
167 }
168
169 // ----------------------------------------------------------------------------
170 // OnXXX() callbacks
171 // ----------------------------------------------------------------------------
172
173 bool wxAppConsole::OnInit()
174 {
175 #if wxUSE_CMDLINE_PARSER
176 wxCmdLineParser parser(argc, argv);
177
178 OnInitCmdLine(parser);
179
180 bool cont;
181 switch ( parser.Parse(false /* don't show usage */) )
182 {
183 case -1:
184 cont = OnCmdLineHelp(parser);
185 break;
186
187 case 0:
188 cont = OnCmdLineParsed(parser);
189 break;
190
191 default:
192 cont = OnCmdLineError(parser);
193 break;
194 }
195
196 if ( !cont )
197 return false;
198 #endif // wxUSE_CMDLINE_PARSER
199
200 return true;
201 }
202
203 int wxAppConsole::OnExit()
204 {
205 #if wxUSE_CONFIG
206 // delete the config object if any (don't use Get() here, but Set()
207 // because Get() could create a new config object)
208 delete wxConfigBase::Set((wxConfigBase *) NULL);
209 #endif // wxUSE_CONFIG
210
211 return 0;
212 }
213
214 void wxAppConsole::Exit()
215 {
216 exit(-1);
217 }
218
219 wxLayoutDirection wxAppConsole::GetLayoutDirection() const
220 {
221 #if wxUSE_INTL
222 const wxLocale *const locale = wxGetLocale();
223 if ( locale )
224 {
225 const wxLanguageInfo *const
226 info = wxLocale::GetLanguageInfo(locale->GetLanguage());
227
228 if ( info )
229 return info->LayoutDirection;
230 }
231 #endif // wxUSE_INTL
232
233 // we don't know
234 return wxLayout_Default;
235 }
236
237 // ----------------------------------------------------------------------------
238 // traits stuff
239 // ----------------------------------------------------------------------------
240
241 wxAppTraits *wxAppConsole::CreateTraits()
242 {
243 return new wxConsoleAppTraits;
244 }
245
246 wxAppTraits *wxAppConsole::GetTraits()
247 {
248 // FIXME-MT: protect this with a CS?
249 if ( !m_traits )
250 {
251 m_traits = CreateTraits();
252
253 wxASSERT_MSG( m_traits, _T("wxApp::CreateTraits() failed?") );
254 }
255
256 return m_traits;
257 }
258
259 // we must implement CreateXXX() in wxApp itself for backwards compatibility
260 #if WXWIN_COMPATIBILITY_2_4
261
262 #if wxUSE_LOG
263
264 wxLog *wxAppConsole::CreateLogTarget()
265 {
266 wxAppTraits *traits = GetTraits();
267 return traits ? traits->CreateLogTarget() : NULL;
268 }
269
270 #endif // wxUSE_LOG
271
272 wxMessageOutput *wxAppConsole::CreateMessageOutput()
273 {
274 wxAppTraits *traits = GetTraits();
275 return traits ? traits->CreateMessageOutput() : NULL;
276 }
277
278 #endif // WXWIN_COMPATIBILITY_2_4
279
280 // ----------------------------------------------------------------------------
281 // event processing
282 // ----------------------------------------------------------------------------
283
284 void wxAppConsole::ProcessPendingEvents()
285 {
286 #if wxUSE_THREADS
287 if ( !wxPendingEventsLocker )
288 return;
289 #endif
290
291 // ensure that we're the only thread to modify the pending events list
292 wxENTER_CRIT_SECT( *wxPendingEventsLocker );
293
294 if ( !wxPendingEvents )
295 {
296 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
297 return;
298 }
299
300 // iterate until the list becomes empty
301 wxList::compatibility_iterator node = wxPendingEvents->GetFirst();
302 while (node)
303 {
304 wxEvtHandler *handler = (wxEvtHandler *)node->GetData();
305 wxPendingEvents->Erase(node);
306
307 // In ProcessPendingEvents(), new handlers might be add
308 // and we can safely leave the critical section here.
309 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
310
311 handler->ProcessPendingEvents();
312
313 wxENTER_CRIT_SECT( *wxPendingEventsLocker );
314
315 node = wxPendingEvents->GetFirst();
316 }
317
318 wxLEAVE_CRIT_SECT( *wxPendingEventsLocker );
319 }
320
321 int wxAppConsole::FilterEvent(wxEvent& WXUNUSED(event))
322 {
323 // process the events normally by default
324 return -1;
325 }
326
327 // ----------------------------------------------------------------------------
328 // exception handling
329 // ----------------------------------------------------------------------------
330
331 #if wxUSE_EXCEPTIONS
332
333 void
334 wxAppConsole::HandleEvent(wxEvtHandler *handler,
335 wxEventFunction func,
336 wxEvent& event) const
337 {
338 // by default, simply call the handler
339 (handler->*func)(event);
340 }
341
342 #endif // wxUSE_EXCEPTIONS
343
344 // ----------------------------------------------------------------------------
345 // cmd line parsing
346 // ----------------------------------------------------------------------------
347
348 #if wxUSE_CMDLINE_PARSER
349
350 #define OPTION_VERBOSE _T("verbose")
351
352 void wxAppConsole::OnInitCmdLine(wxCmdLineParser& parser)
353 {
354 // the standard command line options
355 static const wxCmdLineEntryDesc cmdLineDesc[] =
356 {
357 {
358 wxCMD_LINE_SWITCH,
359 _T("h"),
360 _T("help"),
361 gettext_noop("show this help message"),
362 wxCMD_LINE_VAL_NONE,
363 wxCMD_LINE_OPTION_HELP
364 },
365
366 #if wxUSE_LOG
367 {
368 wxCMD_LINE_SWITCH,
369 wxEmptyString,
370 OPTION_VERBOSE,
371 gettext_noop("generate verbose log messages"),
372 wxCMD_LINE_VAL_NONE,
373 0x0
374 },
375 #endif // wxUSE_LOG
376
377 // terminator
378 {
379 wxCMD_LINE_NONE,
380 wxEmptyString,
381 wxEmptyString,
382 wxEmptyString,
383 wxCMD_LINE_VAL_NONE,
384 0x0
385 }
386 };
387
388 parser.SetDesc(cmdLineDesc);
389 }
390
391 bool wxAppConsole::OnCmdLineParsed(wxCmdLineParser& parser)
392 {
393 #if wxUSE_LOG
394 if ( parser.Found(OPTION_VERBOSE) )
395 {
396 wxLog::SetVerbose(true);
397 }
398 #else
399 wxUnusedVar(parser);
400 #endif // wxUSE_LOG
401
402 return true;
403 }
404
405 bool wxAppConsole::OnCmdLineHelp(wxCmdLineParser& parser)
406 {
407 parser.Usage();
408
409 return false;
410 }
411
412 bool wxAppConsole::OnCmdLineError(wxCmdLineParser& parser)
413 {
414 parser.Usage();
415
416 return false;
417 }
418
419 #endif // wxUSE_CMDLINE_PARSER
420
421 // ----------------------------------------------------------------------------
422 // debugging support
423 // ----------------------------------------------------------------------------
424
425 /* static */
426 bool wxAppConsole::CheckBuildOptions(const char *optionsSignature,
427 const char *componentName)
428 {
429 #if 0 // can't use wxLogTrace, not up and running yet
430 printf("checking build options object '%s' (ptr %p) in '%s'\n",
431 optionsSignature, optionsSignature, componentName);
432 #endif
433
434 if ( strcmp(optionsSignature, WX_BUILD_OPTIONS_SIGNATURE) != 0 )
435 {
436 wxString lib = wxString::FromAscii(WX_BUILD_OPTIONS_SIGNATURE);
437 wxString prog = wxString::FromAscii(optionsSignature);
438 wxString progName = wxString::FromAscii(componentName);
439 wxString msg;
440
441 msg.Printf(_T("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."),
442 lib.c_str(), progName.c_str(), prog.c_str());
443
444 wxLogFatalError(msg.c_str());
445
446 // normally wxLogFatalError doesn't return
447 return false;
448 }
449 #undef wxCMP
450
451 return true;
452 }
453
454 #ifdef __WXDEBUG__
455
456 void wxAppConsole::OnAssertFailure(const wxChar *file,
457 int line,
458 const wxChar *func,
459 const wxChar *cond,
460 const wxChar *msg)
461 {
462 ShowAssertDialog(file, line, func, cond, msg, GetTraits());
463 }
464
465 void wxAppConsole::OnAssert(const wxChar *file,
466 int line,
467 const wxChar *cond,
468 const wxChar *msg)
469 {
470 OnAssertFailure(file, line, NULL, cond, msg);
471 }
472
473 #endif // __WXDEBUG__
474
475 #if WXWIN_COMPATIBILITY_2_4
476
477 bool wxAppConsole::CheckBuildOptions(const wxBuildOptions& buildOptions)
478 {
479 return CheckBuildOptions(buildOptions.m_signature, "your program");
480 }
481
482 #endif
483
484 // ============================================================================
485 // other classes implementations
486 // ============================================================================
487
488 // ----------------------------------------------------------------------------
489 // wxConsoleAppTraitsBase
490 // ----------------------------------------------------------------------------
491
492 #if wxUSE_LOG
493
494 wxLog *wxConsoleAppTraitsBase::CreateLogTarget()
495 {
496 return new wxLogStderr;
497 }
498
499 #endif // wxUSE_LOG
500
501 wxMessageOutput *wxConsoleAppTraitsBase::CreateMessageOutput()
502 {
503 return new wxMessageOutputStderr;
504 }
505
506 #if wxUSE_FONTMAP
507
508 wxFontMapper *wxConsoleAppTraitsBase::CreateFontMapper()
509 {
510 return (wxFontMapper *)new wxFontMapperBase;
511 }
512
513 #endif // wxUSE_FONTMAP
514
515 wxRendererNative *wxConsoleAppTraitsBase::CreateRenderer()
516 {
517 // console applications don't use renderers
518 return NULL;
519 }
520
521 #ifdef __WXDEBUG__
522 bool wxConsoleAppTraitsBase::ShowAssertDialog(const wxString& msg)
523 {
524 return wxAppTraitsBase::ShowAssertDialog(msg);
525 }
526 #endif
527
528 bool wxConsoleAppTraitsBase::HasStderr()
529 {
530 // console applications always have stderr, even under Mac/Windows
531 return true;
532 }
533
534 void wxConsoleAppTraitsBase::ScheduleForDestroy(wxObject *object)
535 {
536 delete object;
537 }
538
539 void wxConsoleAppTraitsBase::RemoveFromPendingDelete(wxObject * WXUNUSED(object))
540 {
541 // nothing to do
542 }
543
544 #if wxUSE_SOCKETS
545 GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable()
546 {
547 return NULL;
548 }
549 #endif
550
551 // ----------------------------------------------------------------------------
552 // wxAppTraits
553 // ----------------------------------------------------------------------------
554
555 #ifdef __WXDEBUG__
556
557 bool wxAppTraitsBase::ShowAssertDialog(const wxString& msg)
558 {
559 return DoShowAssertDialog(msg);
560 }
561
562 #endif // __WXDEBUG__
563
564 // ============================================================================
565 // global functions implementation
566 // ============================================================================
567
568 void wxExit()
569 {
570 if ( wxTheApp )
571 {
572 wxTheApp->Exit();
573 }
574 else
575 {
576 // what else can we do?
577 exit(-1);
578 }
579 }
580
581 void wxWakeUpIdle()
582 {
583 if ( wxTheApp )
584 {
585 wxTheApp->WakeUpIdle();
586 }
587 //else: do nothing, what can we do?
588 }
589
590 #ifdef __WXDEBUG__
591
592 // wxASSERT() helper
593 bool wxAssertIsEqual(int x, int y)
594 {
595 return x == y;
596 }
597
598 // break into the debugger
599 void wxTrap()
600 {
601 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
602 DebugBreak();
603 #elif defined(__WXMAC__) && !defined(__DARWIN__)
604 #if __powerc
605 Debugger();
606 #else
607 SysBreak();
608 #endif
609 #elif defined(_MSL_USING_MW_C_HEADERS) && _MSL_USING_MW_C_HEADERS
610 Debugger();
611 #elif defined(__UNIX__)
612 raise(SIGTRAP);
613 #else
614 // TODO
615 #endif // Win/Unix
616 }
617
618 // this function is called when an assert fails
619 void wxOnAssert(const wxChar *szFile,
620 int nLine,
621 const char *szFunc,
622 const wxChar *szCond,
623 const wxChar *szMsg)
624 {
625 // FIXME MT-unsafe
626 static bool s_bInAssert = false;
627
628 if ( s_bInAssert )
629 {
630 // He-e-e-e-elp!! we're trapped in endless loop
631 wxTrap();
632
633 s_bInAssert = false;
634
635 return;
636 }
637
638 s_bInAssert = true;
639
640 // __FUNCTION__ is always in ASCII, convert it to wide char if needed
641 const wxString strFunc = wxString::FromAscii(szFunc);
642
643 if ( !wxTheApp )
644 {
645 // by default, show the assert dialog box -- we can't customize this
646 // behaviour
647 ShowAssertDialog(szFile, nLine, strFunc, szCond, szMsg);
648 }
649 else
650 {
651 // let the app process it as it wants
652 wxTheApp->OnAssertFailure(szFile, nLine, strFunc, szCond, szMsg);
653 }
654
655 s_bInAssert = false;
656 }
657
658 #endif // __WXDEBUG__
659
660 // ============================================================================
661 // private functions implementation
662 // ============================================================================
663
664 #ifdef __WXDEBUG__
665
666 static void LINKAGEMODE SetTraceMasks()
667 {
668 #if wxUSE_LOG
669 wxString mask;
670 if ( wxGetEnv(wxT("WXTRACE"), &mask) )
671 {
672 wxStringTokenizer tkn(mask, wxT(",;:"));
673 while ( tkn.HasMoreTokens() )
674 wxLog::AddTraceMask(tkn.GetNextToken());
675 }
676 #endif // wxUSE_LOG
677 }
678
679 bool DoShowAssertDialog(const wxString& msg)
680 {
681 // under MSW we can show the dialog even in the console mode
682 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
683 wxString msgDlg(msg);
684
685 // this message is intentionally not translated -- it is for
686 // developpers only
687 msgDlg += wxT("\nDo you want to stop the program?\n")
688 wxT("You can also choose [Cancel] to suppress ")
689 wxT("further warnings.");
690
691 switch ( ::MessageBox(NULL, msgDlg, _T("wxWidgets Debug Alert"),
692 MB_YESNOCANCEL | MB_ICONSTOP ) )
693 {
694 case IDYES:
695 wxTrap();
696 break;
697
698 case IDCANCEL:
699 // stop the asserts
700 return true;
701
702 //case IDNO: nothing to do
703 }
704 #else // !__WXMSW__
705 wxFprintf(stderr, wxT("%s\n"), msg.c_str());
706 fflush(stderr);
707
708 // TODO: ask the user to enter "Y" or "N" on the console?
709 wxTrap();
710 #endif // __WXMSW__/!__WXMSW__
711
712 // continue with the asserts
713 return false;
714 }
715
716 #if wxUSE_STACKWALKER
717 static wxString GetAssertStackTrace()
718 {
719 wxString stackTrace;
720
721 class StackDump : public wxStackWalker
722 {
723 public:
724 StackDump() { }
725
726 const wxString& GetStackTrace() const { return m_stackTrace; }
727
728 protected:
729 virtual void OnStackFrame(const wxStackFrame& frame)
730 {
731 m_stackTrace << wxString::Format
732 (
733 _T("[%02d] "),
734 wx_truncate_cast(int, frame.GetLevel())
735 );
736
737 wxString name = frame.GetName();
738 if ( !name.empty() )
739 {
740 m_stackTrace << wxString::Format(_T("%-40s"), name.c_str());
741 }
742 else
743 {
744 m_stackTrace << wxString::Format(_T("%p"), frame.GetAddress());
745 }
746
747 if ( frame.HasSourceLocation() )
748 {
749 m_stackTrace << _T('\t')
750 << frame.GetFileName()
751 << _T(':')
752 << frame.GetLine();
753 }
754
755 m_stackTrace << _T('\n');
756 }
757
758 private:
759 wxString m_stackTrace;
760 };
761
762 StackDump dump;
763 dump.Walk(2); // don't show OnAssert() call itself
764 stackTrace = dump.GetStackTrace();
765
766 // don't show more than maxLines or we could get a dialog too tall to be
767 // shown on screen: 20 should be ok everywhere as even with 15 pixel high
768 // characters it is still only 300 pixels...
769 static const int maxLines = 20;
770 const int count = stackTrace.Freq(wxT('\n'));
771 for ( int i = 0; i < count - maxLines; i++ )
772 stackTrace = stackTrace.BeforeLast(wxT('\n'));
773
774 return stackTrace;
775 }
776 #endif // wxUSE_STACKWALKER
777
778 // show the assert modal dialog
779 static
780 void ShowAssertDialog(const wxChar *szFile,
781 int nLine,
782 const wxChar *szFunc,
783 const wxChar *szCond,
784 const wxChar *szMsg,
785 wxAppTraits *traits)
786 {
787 // this variable can be set to true to suppress "assert failure" messages
788 static bool s_bNoAsserts = false;
789
790 wxString msg;
791 msg.reserve(2048);
792
793 // make life easier for people using VC++ IDE by using this format: like
794 // this, clicking on the message will take us immediately to the place of
795 // the failed assert
796 msg.Printf(wxT("%s(%d): assert \"%s\" failed"), szFile, nLine, szCond);
797
798 // add the function name, if any
799 if ( szFunc && *szFunc )
800 msg << _T(" in ") << szFunc << _T("()");
801
802 // and the message itself
803 if ( szMsg )
804 {
805 msg << _T(": ") << szMsg;
806 }
807 else // no message given
808 {
809 msg << _T('.');
810 }
811
812 #if wxUSE_STACKWALKER
813 const wxString stackTrace = GetAssertStackTrace();
814 if ( !stackTrace.empty() )
815 {
816 msg << _T("\n\nCall stack:\n") << stackTrace;
817 }
818 #endif // wxUSE_STACKWALKER
819
820 #if wxUSE_THREADS
821 // if we are not in the main thread, output the assert directly and trap
822 // since dialogs cannot be displayed
823 if ( !wxThread::IsMain() )
824 {
825 msg += wxT(" [in child thread]");
826
827 #if defined(__WXMSW__) && !defined(__WXMICROWIN__)
828 msg << wxT("\r\n");
829 OutputDebugString(msg );
830 #else
831 // send to stderr
832 wxFprintf(stderr, wxT("%s\n"), msg.c_str());
833 fflush(stderr);
834 #endif
835 // He-e-e-e-elp!! we're asserting in a child thread
836 wxTrap();
837 }
838 else
839 #endif // wxUSE_THREADS
840
841 if ( !s_bNoAsserts )
842 {
843 // send it to the normal log destination
844 wxLogDebug(_T("%s"), msg.c_str());
845
846 if ( traits )
847 {
848 // delegate showing assert dialog (if possible) to that class
849 s_bNoAsserts = traits->ShowAssertDialog(msg);
850 }
851 else // no traits object
852 {
853 // fall back to the function of last resort
854 s_bNoAsserts = DoShowAssertDialog(msg);
855 }
856 }
857 }
858
859 #endif // __WXDEBUG__