MenuPanel.st
branchjv
changeset 5250 a4da316f8065
parent 5247 90655676e59b
parent 5248 b869436ed677
child 5260 c36548c31c27
--- a/MenuPanel.st	Wed Sep 14 06:50:14 2016 +0200
+++ b/MenuPanel.st	Tue Sep 20 07:03:06 2016 +0200
@@ -862,7 +862,7 @@
     ].
 
     Images isNil ifTrue:[ 
-        Images := WeakIdentityDictionary new.
+        Images := IdentityDictionary new.
     ].
     deviceImages := Images at:aDevice ifAbsentPut:[Dictionary new].
     ^ deviceImages at:anImage ifAbsentPut:[anImage copy onDevice:aDevice].
@@ -874,7 +874,7 @@
 "
     |deviceImages image colorMap|
 
-    LigthenedImages isNil ifTrue:[LigthenedImages := WeakIdentityDictionary new].
+    LigthenedImages isNil ifTrue:[LigthenedImages := IdentityDictionary new].
 
     deviceImages := LigthenedImages at:aDevice ifAbsentPut:[WeakIdentityDictionary new].
     (image := deviceImages at:anImage ifAbsent:nil) notNil ifTrue:[
@@ -889,6 +889,23 @@
     ].
     deviceImages at:anImage put:image.
     ^ image
+!
+
+releaseCachedImagesFromDevice:aGraphicsDevice
+    "flush cached resources before saving a snapshot
+     (do not save them in the image)"
+
+    aGraphicsDevice isNil ifTrue:[
+        Images := LigthenedImages := nil.
+        ^ self.
+    ].
+
+    Images notNil ifTrue:[
+        Images removeKey:aGraphicsDevice ifAbsent:[].
+    ].
+    LigthenedImages notNil ifTrue:[
+        LigthenedImages removeKey:aGraphicsDevice ifAbsent:[].
+    ].
 ! !
 
 !MenuPanel class methodsFor:'private'!
@@ -907,8 +924,7 @@
     "flush cached resources before saving a snapshot
      (do not save them in the image)"
 
-    Images := nil.
-    LigthenedImages := nil.
+    self releaseCachedImagesFromDevice:nil
 ! !
 
 !MenuPanel class methodsFor:'utilities'!