]> gitweb.factorcode.org Git - factor.git/commitdiff
ui: try and ensure that the ui thread finishes #1905
authorBjörn Lindqvist <bjourne@gmail.com>
Mon, 29 Jan 2018 06:55:36 +0000 (07:55 +0100)
committerBjörn Lindqvist <bjourne@gmail.com>
Mon, 29 Jan 2018 06:55:36 +0000 (07:55 +0100)
basis/ui/ui-tests.factor [new file with mode: 0644]
basis/ui/ui.factor

diff --git a/basis/ui/ui-tests.factor b/basis/ui/ui-tests.factor
new file mode 100644 (file)
index 0000000..a480b4a
--- /dev/null
@@ -0,0 +1,9 @@
+USING: assocs kernel threads tools.test ui ;
+IN: ui.tests
+
+{ t } [
+    ! with-ui shouldn't leave any thread hanging around.
+    threads assoc-size
+    [ ] with-ui
+    threads assoc-size =
+] unit-test
index d23416ca19a9f2621b116d16f3a9b3ff873694ed..43af6f6c815862683d6b71d268bcc0bde10ce3ad 100644 (file)
@@ -224,7 +224,11 @@ M: object resize-window 2drop ;
     ui-running? [ call( -- ) ] [
         t ui-running set-global '[
             [ init-ui @ ] (with-ui)
-        ] [ f ui-running set-global ] [ ] cleanup
+        ] [
+            f ui-running set-global
+            ! Give running ui threads a chance to finish.
+            notify-ui-thread yield
+        ] [ ] cleanup
     ] if ;
 
 HOOK: beep ui-backend ( -- )