Not really a bug, but...

Rob Gayvert rtg at rochester.rr.com
Sat Mar 5 02:02:56 UTC 2005


Steven Swerling wrote:

> Hi Rob,
>
> I've been plodding along w/WxMorphicPanel, things seem to be going 
> well, knock on wood.
>
> I did get some crashes during image save since my subclass of 
> TopLevelPresenter does not yet know how to "saveView" or "restoreView".
>
> Somehow, one of my test windows was in AllTopLevelPresenters even 
> though it was no longer alive. I managed to get quite a few crashes 
> during the early stages of my work w/ WxMorphicPanel. Somehow during 
> this phase I must have got a bug that didn't crash the image but 
> managed to mangle the 'deleteObject' machinery.
>
> Anyway, the little snippet below fixed the problem. Just does a 
> #isValid check on the view's handle before calling storeView.
>
> !TopLevelPresenter class methodsFor: 'as yet unclassified' stamp: 'sps 
> 3/4/2005 13:22'!
> shuttingDown: quitting
>
>     WxBase removeDeletedObjects.
>     
>     self allTopLevelPresenters copy do: [:presenter |
>         presenter view handle isValid
>             ifTrue:[    presenter storeView ]
>             ifFalse: [self allTopLevelPresenters remove: presenter]
>     ].
> ! !

Good catch. I'm adding more null pointer checks in the primitives to 
prevent the VM from crashing, but we'll probably still need isValid 
checks at points like this to make it clean up properly.








More information about the Wxsqueak mailing list