ui.backend.cocoa: invalidate run loop timers before raising an NSAlert and add them back when runModal returns to avoid run loop callbacks reentering Factor
parent
b7727bc695
commit
2aa1a3dbd7
|
@ -91,6 +91,9 @@ TUPLE: run-loop fds sources timers ;
|
|||
CFRunLoopAddTimer
|
||||
] bi ;
|
||||
|
||||
: invalidate-run-loop-timers ( -- )
|
||||
run-loop [ [ [ CFRunLoopTimerInvalidate ] [ CFRelease ] bi ] each V{ } ] change-timers drop ;
|
||||
|
||||
<PRIVATE
|
||||
|
||||
: ((reset-timer)) ( timer counter timestamp -- )
|
||||
|
|
|
@ -214,6 +214,7 @@ M: cocoa-ui-backend beep ( -- )
|
|||
NSBeep ;
|
||||
|
||||
M: cocoa-ui-backend system-alert
|
||||
invalidate-run-loop-timers
|
||||
NSAlert -> alloc -> init -> autorelease [
|
||||
{
|
||||
[ swap <NSString> -> setInformativeText: ]
|
||||
|
@ -221,7 +222,8 @@ M: cocoa-ui-backend system-alert
|
|||
[ "OK" <NSString> -> addButtonWithTitle: drop ]
|
||||
[ -> runModal drop ]
|
||||
} cleave
|
||||
] [ 2drop ] if* ;
|
||||
] [ 2drop ] if*
|
||||
init-thread-timer ;
|
||||
|
||||
CLASS: {
|
||||
{ +superclass+ "NSObject" }
|
||||
|
|
Loading…
Reference in New Issue