Path: utzoo!attcan!uunet!tektronix!tekcrl!tekgvs!jans From: jans@tekgvs.GVS.TEK.COM (Jan Steinman) Newsgroups: comp.lang.smalltalk Subject: Re: Unwanted Instances Message-ID: <4179@tekgvs.GVS.TEK.COM> Date: 1 Nov 88 00:03:50 GMT Distribution: na Organization: Tektronix Inc., Beaverton, Or. Lines: 42 <> <> <..."release" is a good first level of defense..., (but doesn't) always work.. (for) those cases where an execution error interrupts the normal flow of control and prevents various "release" methods from ever being sent... The only thing I can think of to do is to implement a special case of your "dialog":> (N.B.: The following is for Tek Smalltalk, your mileage may vary. I just wrote it on the spot to illustrate the point, and it should not be considered a fully debugged solution!) As a starting point, here is a method that will execute a block for each sender in the context. When things break, DO NOT throw away the debugger, instead, execute within the debugger: thisContext sendersDo: [:sender | (#(TroublesomeClass1 TroublesomeClass2) includes: sender class) ifTrue: [sender release]] Note that simply putting "sender release" in the block will probably irrepairably damage your image, as things like ControlManager get released! {!ContextPart methodsFor: 'testing'! sendersDo: aBlock "Cause each sender receiver to execute with itself as the argument." | ctx | ctx _ self. [true] whileTrue: [aBlock value: ctx receiver. (ctx _ ctx sender) == nil ifTrue: [^self]]! !} :::::: Software Productivity Technologies -- Experiment Manager Project :::::: :::::: Jan Steinman N7JDB Box 500, MS 50-383 (w)503/627-5881 :::::: :::::: jans@tekcrl.TEK.COM Beaverton, OR 97077 (h)503/657-7703 ::::::