GraphicsMedium.st
changeset 7443 e2d05b756727
parent 7420 c1c1c574f217
child 7447 b1b0c9c2a455
--- a/GraphicsMedium.st	Wed Jul 20 17:07:38 2016 +0200
+++ b/GraphicsMedium.st	Wed Jul 20 18:26:01 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -11,6 +9,8 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
+'From Smalltalk/X, Version:7.1.0.0 on 20-07-2016 at 17:08:14'                   !
+
 "{ Package: 'stx:libview' }"
 
 "{ NameSpace: Smalltalk }"
@@ -2599,11 +2599,12 @@
 !
 
 destroy
-    "destroy a medium - here the fc is completely destroyed"
+    "destroy a medium - here the gc is completely destroyed"
 
     gc notNil ifTrue:[
-	gc destroy.
+        gc destroy.
     ].
+    device := nil.
     realized := false.
 !
 
@@ -2627,14 +2628,8 @@
     "allocate a GraphicsContext for a device"
 
     aDevice notNil ifTrue:[
-	device := aDevice.
-	gc := aDevice newGraphicsContextFor:self.
-    ] ifFalse:[
-	"should not be reached"
-	GraphicsMedium superclass == DeviceGraphicsContext ifTrue:[
-	    gc := self.
-	    super device:aDevice.
-	].
+        device := aDevice.
+        gc := aDevice newGraphicsContextFor:self.
     ].
 
     self initialize.
@@ -2680,6 +2675,7 @@
 setDevice:aDevice id:aDrawbleId gcId:aGCId
     "private"
 
+    device := aDevice.
     gc notNil ifTrue:[
         gc setDevice:aDevice id:aDrawbleId gcId:aGCId
     ].