gtk (surface-ink-flush): Use with-glib-lock.
authorMatt Birkholz <matt@birchwood-abbey.net>
Sun, 11 Mar 2018 22:59:57 +0000 (15:59 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Sun, 11 Mar 2018 22:59:57 +0000 (15:59 -0700)
Signal-thread-event is too asynchronous, catching glib-thread without
its glib-mutex lock.

src/gtk/fix-layout.scm

index d371f304c9e82d5b2f07b9df06ce145c505d08cd..c74ab3b424baf8929a9cd673aa7b8aee0fc996c7 100644 (file)
@@ -1794,19 +1794,18 @@ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
            surface)))))
 
 (define (surface-ink-flush ink)
-  (let ((surface (surface-ink-surface ink))
-       (exposed (surface-ink-exposed ink)))
+  (let ((surface (surface-ink-surface ink)))
     (cairo-surface-flush surface)
-    (if exposed
-       (signal-thread-event glib-thread
-         (lambda ()
-           (%trace2 ";surface-ink-flush copying\n")
-           (let ((cr (cairo-create exposed)))
-             (cairo-set-source-surface cr surface 0 0)
-             (cairo-paint cr)
-             (cairo-destroy cr))
-           (cairo-surface-flush exposed))))
-    (drawing-damage ink)))
+    (with-glib-lock
+     (lambda ()
+       (let ((exposed (surface-ink-exposed ink)))
+        (if exposed
+            (let ((cr (cairo-create exposed)))
+              (cairo-set-source-surface cr surface 0 0)
+              (cairo-paint cr)
+              (cairo-destroy cr)
+              (cairo-surface-flush exposed)))
+        (drawing-damage ink))))))
 
 (define (set-surface-ink-position! ink x y)
   (set-fix-rect-position! (fix-ink-extent ink) x y))