--- a/Form.st Fri Oct 11 08:54:12 2019 +0200
+++ b/Form.st Fri Oct 11 10:19:39 2019 +0200
@@ -1162,17 +1162,17 @@
asImageForm
"convert & return the receiver into a ImageForm instance"
- |imageForm|
+ |imageForm lobby|
imageForm := ImageForm cloneFrom:self.
"kludge: have to unregister. Otherwise the form will be destroyed when
we are garbage collected"
- gc finalizationLobby
- unregister:gc;
- registerChange:imageForm graphicsContext.
-
+ (lobby := gc finalizationLobby) notNil ifTrue:[
+ lobby unregister:gc.
+ lobby registerChange:imageForm graphicsContext.
+ ].
^ imageForm.
! !