[Wxsqueak] Re: Putting halts in event handlers
dan
mr.d.poon at gmail.com
Tue Dec 19 16:40:15 UTC 2006
Hi Rob
Rob Gayvert wrote:
> Hi Daniel,
>
> It turns out that this is the worst-case scenario for callbacks. In this
> demo, this method comes from a callback that is triggered by an event
> callback, so there are two return points on the C stack. When the halt
> is encountered, WxEvtHandler class>>checkCallbackException is run, but
> it restores the wrong point on the C stack, crashing the VM.
>
> There are a couple of difficulties here. The exception check could be
> improved to avoid the crash (it should check for the generic case
> first), but then you wind up with a big pile of debugger windows, since
> after restoring the C stack, the calling routine in the wx library
> continues doing its comparisons.
That old chestnut...
Sounds pretty much like what happens when you put a halt in a VSE
callback: you also get a 'big pile of debugger windows' in certain
situations.
> I'm currently working on unifying the two different kinds of callbacks
> in order to avoid this kind of problem. Even then, though, if you put a
> halt inside a Squeak callback method, you're going to get some odd
> behavior, because the callback must be completed back to the wx library.
> Your best bet in this case is to use some old-fashioned logging (e.g.,
> Wx logMessage:). Not very Smalltalk-like, but it's safe.
If you get an exception in the callback, it seems like you catch it and
ignore it, right?
We have been discussing callbacks in the general squeak list. It looks
like you have done some interesting stuff regarding putting callback
support into the VM. Is that right?
Cheers
Daniel
More information about the Wxsqueak
mailing list