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