HostGraphicsDevice.st
changeset 6884 a66985ff01e9
parent 6212 3c308b5defa7
child 7443 e2d05b756727
--- a/HostGraphicsDevice.st	Tue Jun 30 18:02:02 2015 +0200
+++ b/HostGraphicsDevice.st	Thu Jul 23 12:45:09 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
 COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
 	      All Rights Reserved
@@ -11,6 +13,8 @@
 "
 "{ Package: 'stx:libview' }"
 
+"{ NameSpace: Smalltalk }"
+
 GraphicsDevice subclass:#HostGraphicsDevice
 	instanceVariableNames:'deviceColors deviceFonts deviceViews deviceForms deviceCursors'
 	classVariableNames:''
@@ -148,33 +152,38 @@
 !
 
 releaseDeviceColors
-    deviceColors do:[:aColor |
-        aColor releaseFromDevice
+    deviceColors notNil ifTrue:[
+        deviceColors do:[:aColor |
+            aColor releaseFromDevice
+        ].
+        deviceColors := Registry new.
+
+        "TrueColors are not registered.
+         Release the the hard way"
+        Color flushDeviceColorsFor:self.
     ].
-    deviceColors := Registry new.
-
-    "TrueColors are not registered.
-     Release the the hard way"
-    Color flushDeviceColorsFor:self.
 
     "Created: 24.2.1997 / 18:07:49 / cg"
 !
 
 releaseDeviceCursors
-    deviceCursors do:[:aCursor |
-        aCursor releaseFromDevice
-    ].
-    deviceCursors := Registry new.
+    deviceCursors notNil ifTrue:[
+        deviceCursors do:[:aCursor |
+            aCursor releaseFromDevice
+        ].
+        deviceCursors := Registry new.
+    ]
 
     "Created: 24.2.1997 / 18:07:49 / cg"
-
 !
 
 releaseDeviceFonts
-    deviceFonts do:[:aFont |
-        aFont releaseFromDevice.
+    deviceFonts notNil ifTrue:[
+        deviceFonts do:[:aFont |
+            aFont releaseFromDevice.
+        ].
+        deviceFonts := CachingRegistry new cacheSize:10.
     ].
-    deviceFonts := CachingRegistry new cacheSize:10.
 ! !
 
 !HostGraphicsDevice methodsFor:'misc'!
@@ -260,6 +269,6 @@
 !HostGraphicsDevice class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/HostGraphicsDevice.st,v 1.25 2014-02-03 10:26:51 cg Exp $'
+    ^ '$Header$'
 ! !