Possible fix for error raised by build-rectangle

When switching tabs while an on-reflow initiated callback
might still be running can lead to bogus information
coming back from position-locations, as the editor loses
its admin.

So, we just give up recomputing the rectangles when the
admin is gone and, for now, expect that there will be
another on-reflow call when the admin comes back that'll
restart the process (not sure that this is guaranteed tho)

original commit: 52d0b7e352a493e127e0d7cd780a34938dddea08
This commit is contained in:
Robby Findler 2012-11-28 09:44:08 -06:00
parent f0e71cebf5
commit d54e68a2e7

View File

@ -122,6 +122,10 @@
(define recompute-callback-running? #f) (define recompute-callback-running? #f)
(define/private (run-recompute-range-rectangles) (define/private (run-recompute-range-rectangles)
(when (get-admin)
;; when there is no admin, then the position-location information
;; is bogus, so we just give up trying to recompute this information
(define done-time (+ (current-inexact-milliseconds) 20)) (define done-time (+ (current-inexact-milliseconds) 20))
(define did-something? #f) (define did-something? #f)
(let loop ([left #f] (let loop ([left #f]
@ -163,7 +167,7 @@
;; when old-rectangles is #f, that means that this ;; when old-rectangles is #f, that means that this
;; range has been removed from the ranges-deq, so ;; range has been removed from the ranges-deq, so
;; can just skip over it here. ;; can just skip over it here.
(loop left top right bottom)])]))) (loop left top right bottom)])]))))
(define/private (join-rectangles left top right bottom r) (define/private (join-rectangles left top right bottom r)
(define this-left (define this-left