#BUGFIX by cg
class: CodeCompletionHelpView
make sure that I close myself, if the editView is no
longer present.
class definition
added:
#checkForClosedEditor
#release
changed: #realize
--- a/CodeCompletionHelpView.st Thu Feb 14 10:42:01 2019 +0100
+++ b/CodeCompletionHelpView.st Thu Feb 14 15:48:37 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2013 by Claus Gittinger
All Rights Reserved
@@ -14,7 +16,7 @@
"{ NameSpace: Smalltalk }"
View subclass:#CodeCompletionHelpView
- instanceVariableNames:'myView editView delayedCloseAction'
+ instanceVariableNames:'myView editView delayedCloseAction checkAction'
classVariableNames:''
poolDictionaries:''
category:'Interface-Help'
@@ -214,6 +216,24 @@
!CodeCompletionHelpView methodsFor:'initialization'!
+checkForClosedEditor
+ |a|
+
+ (a := checkAction) notNil ifTrue:[
+ (editView isNil
+ or:[editView realized not
+ or:[editView topView shown not]]
+ ) ifTrue:[
+ self pushEvent:#closeRequest.
+ checkAction := nil.
+ ] ifFalse:[
+ Processor addTimedBlock:a for:nil afterSeconds:5.
+ ]
+ ]
+
+ "Created: / 14-02-2019 / 15:33:26 / Claus Gittinger"
+!
+
initStyle
"setup viewStyle specifics"
@@ -246,9 +266,29 @@
self subViews do:[:eachView |
eachView delegate:self.
].
+
+ "/ install a watcher to check for the editView being still present
+ "/ from time to time.
+ "/ this prevents leftover completion views in case the editView is destroyed
+ "/ and forgets to tell me...
+ checkAction := [self checkForClosedEditor].
+ Processor addTimedBlock:checkAction for:nil afterSeconds:5.
+
super realize
- "Modified: / 04-08-2018 / 16:53:13 / Claus Gittinger"
+ "Modified: / 14-02-2019 / 15:34:17 / Claus Gittinger"
+!
+
+release
+ |a|
+
+ (a := checkAction) notNil ifTrue:[
+ checkAction := nil.
+ Processor removeTimedBlock:a.
+ ].
+ super release.
+
+ "Created: / 14-02-2019 / 15:35:32 / Claus Gittinger"
! !
!CodeCompletionHelpView methodsFor:'private'!