fix `image-snip%' unmarshaling with filename
Merge to 5.1
(cherry picked from commit c2c6c79a15
)
This commit is contained in:
parent
9b9dc8c2f8
commit
9215e3c401
|
@ -787,8 +787,7 @@
|
||||||
(def/override (read [editor-stream-in% f])
|
(def/override (read [editor-stream-in% f])
|
||||||
(let ([scl (get-the-snip-class-list)]
|
(let ([scl (get-the-snip-class-list)]
|
||||||
[can-inline? ((send f do-reading-version this) . > . 1)])
|
[can-inline? ((send f do-reading-version this) . > . 1)])
|
||||||
(let ([filename (let ([s (send f get-bytes #f)])
|
(let ([filename (send f get-bytes #f)])
|
||||||
(subbytes s 0 (max 0 (sub1 (bytes-length s)))))])
|
|
||||||
(let-boxes ([type 0]
|
(let-boxes ([type 0]
|
||||||
[w 0.0]
|
[w 0.0]
|
||||||
[h 0.0]
|
[h 0.0]
|
||||||
|
|
|
@ -1347,4 +1347,23 @@
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
|
|
||||||
|
(let ()
|
||||||
|
(define (mk) (make-object image-snip% (collection-file-path "b-run.png" "icons") 'unknown #f #f))
|
||||||
|
|
||||||
|
(define is (mk))
|
||||||
|
(define copy-is
|
||||||
|
(let ()
|
||||||
|
(define sp (open-output-string))
|
||||||
|
(define t (new text%))
|
||||||
|
(send t insert (mk))
|
||||||
|
(send t save-port sp)
|
||||||
|
(define t2 (new text%))
|
||||||
|
(send t2 insert-port (open-input-string (get-output-string sp)))
|
||||||
|
(send t2 find-first-snip)))
|
||||||
|
|
||||||
|
(expect (send (mk) get-filename)
|
||||||
|
(send copy-is get-filename)))
|
||||||
|
|
||||||
|
;; ----------------------------------------
|
||||||
|
|
||||||
(done)
|
(done)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user