From 2aa1a3dbd7f14836c0c19692b9b0ba6562046aca Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Tue, 23 Feb 2010 23:50:34 -0800 Subject: [PATCH] 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 --- basis/core-foundation/run-loop/run-loop.factor | 3 +++ basis/ui/backend/cocoa/cocoa.factor | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/basis/core-foundation/run-loop/run-loop.factor b/basis/core-foundation/run-loop/run-loop.factor index 2370dd4562..e2ba06d61f 100644 --- a/basis/core-foundation/run-loop/run-loop.factor +++ b/basis/core-foundation/run-loop/run-loop.factor @@ -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 ; + alloc -> init -> autorelease [ { [ swap -> setInformativeText: ] @@ -221,7 +222,8 @@ M: cocoa-ui-backend system-alert [ "OK" -> addButtonWithTitle: drop ] [ -> runModal drop ] } cleave - ] [ 2drop ] if* ; + ] [ 2drop ] if* + init-thread-timer ; CLASS: { { +superclass+ "NSObject" }