Skip to content

Commit b968c7c

Browse files
author
徐扬斌
committed
MacOS: Catch all exceptions thrown by wxCFEventLoop::OSXDoRun() for cocoa modal dialog.
The cocoa framework is not bug-free. Some version(I'd called it buggy) may throw unexpected exceptions. In order to avoid the ShowModal() to died and break the modal stack, and finally comes you a assertion failure on broken modal stack, we should catch exceptions here.
1 parent e3f8306 commit b968c7c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/osx/cocoa/evtloop.mm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,15 @@ static NSUInteger CalculateNSEventMaskFromEventCategory(wxEventCategory cat)
434434
if ( m_modalWindow )
435435
{
436436
BeginModalSession(m_modalWindow);
437-
wxCFEventLoop::OSXDoRun();
437+
while(true){
438+
try {
439+
wxCFEventLoop::OSXDoRun();
440+
break;
441+
}
442+
catch(...){
443+
printf("wxModalEventLoop::OSXDoRun caught unknown exception\n");
444+
}
445+
}
438446
EndModalSession();
439447
}
440448
else

0 commit comments

Comments
 (0)