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