Fixed the demo so the spinner thread will end.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 6 Oct 2011 22:25:58 +0000 (15:25 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 6 Oct 2011 22:25:58 +0000 (15:25 -0700)
Destroyed widgets now remove themselves from a drawing's list of
widgets, but NULL was assumed to mean "haven't had any viewers yet",
not "all viewers gone".

src/gtk/fix-demo.scm

index 5943a78f23aae15b85a60b0fd30308c32edb6c1c..956663a8d57705b81413f2d06dc1990a3281d319 100644 (file)
@@ -59,6 +59,10 @@ USA.
        (fix-drawing-add-ink! drawing cursor2 'bottom)
        (set-demo-drawing-cursor-inks!
         drawing (list (list cursor1 layout1) (list cursor2 layout2))))
+
+      (set-fix-layout-drawing! layout1 drawing 175 150)
+      (set-fix-layout-drawing! layout2 drawing 175 150)
+      ;; Attach widgets to drawing BEFORE starting blink/spin threads.
       (if blink?
          (let ((thread (start-blinking drawing)))
            (%trace ";cursor blinker: "thread"\n"))
@@ -66,9 +70,7 @@ USA.
       (if spin?
          (let ((thread (start-spinning drawing)))
            (%trace ";ring spinner: "thread"\n"))
-         (%trace ";ring spinning disabled\n"))
-      (set-fix-layout-drawing! layout1 drawing 175 150)
-      (set-fix-layout-drawing! layout2 drawing 175 150))
+         (%trace ";ring spinning disabled\n")))
     (gtk-widget-grab-focus layout1)
     (%trace ";created "layout1" and "layout2"\n"))
   unspecific)
@@ -215,8 +217,7 @@ USA.
             (%trace2 ";spinning to "width"\n")
             (set-arc-ink! arc x y width height)))
         (let ((widgets (fix-drawing-widgets drawing)))
-          (if (and (not (null? widgets))
-                   (for-all? widgets gtk-object-destroyed?))
+          (if (null? widgets)
               (%trace ";spinning ended\n")
               (loop (modulo (fix:1+ frame) frames)))))))))