From 418b3deb7057e2a2b2d86d5c3d12af913daeb2ac Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Fri, 16 Sep 2011 11:57:15 -0700 Subject: [PATCH] Take greater care with clear-cached-pango-layout. --- src/gtk-screen/gtk-screen.scm | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/gtk-screen/gtk-screen.scm b/src/gtk-screen/gtk-screen.scm index 37a57af6e..49f687acd 100644 --- a/src/gtk-screen/gtk-screen.scm +++ b/src/gtk-screen/gtk-screen.scm @@ -2011,8 +2011,10 @@ USA. (define (remove-line line) (mark-temporary! (line-ink-start line)) (mark-temporary! (line-ink-end line)) - (fix-ink-remove! line) - (clear-cached-pango-layout line)) + (without-interrupts + (lambda () + (clear-cached-pango-layout line) + (fix-ink-remove! line)))) (define (no-display-changes?) ;; If the drawing already agrees with the buffer and its current @@ -2388,15 +2390,24 @@ USA. ;; Do not (call-next-method ink). There is no method. (if (unchanged? ink) (or (line-ink-cached-pango-layout ink) - (let ((layout (or (salvage-pango-layout ink) - (cache-pango-layout ink)))) - (layout-line! ink layout) - layout)) + ;; When executed by the expose handler, this already runs + ;; without-interrupts. However there are other places + ;; (e.g. redraw-cursor) where this could be called. Ensure + ;; that the async. expose handlers do not start frobbing the + ;; pango-layout cache until we are done here. + (without-interrupts + (lambda () + (let ((layout (or (salvage-pango-layout ink) + (cache-pango-layout ink)))) + (layout-line! ink layout) + layout)))) (begin (outf-error ";text-ink-pango-layout: punted "ink"\n") #f))) (define (clear-cached-pango-layout line) + ;; This probably aught to be done without-interrupts, since it + ;; frobs a cache used (filled!) by the async expose handler. (let ((layout (line-ink-cached-pango-layout line))) (if layout (let* ((drawing (fix-ink-drawing line)) -- 2.25.1