From b39fdd0a48bf1c816885039426087c91fb5d3996 Mon Sep 17 00:00:00 2001 From: Thomas Friedel Date: Sat, 21 Mar 2020 13:20:54 +0100 Subject: [PATCH] added panic when an image is loaded with a different canvas --- images.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/images.go b/images.go index 3b84b66..7581ff4 100644 --- a/images.go +++ b/images.go @@ -28,6 +28,9 @@ type Image struct { func (cv *Canvas) LoadImage(src interface{}) (*Image, error) { var reload *Image if img, ok := src.(*Image); ok { + if img.cv != cv { + panic("image loaded with different canvas") + } if img.deleted { reload = img src = img.src