Re: [AD] 4.0.2 releasei/CVS

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Thursday 20 June 2002 03:08, Peter Wang wrote:
> What's going on: When you press the close button, an auxiliary thread
> starts the shutdown process (with `exit').  Meanwhile, the main thread
> is still running concurrently, and not expecting the rug to be pulled
> out from under its feet.  e.g. it might try writing to `screen', right
> after it is freed, causing a segfault.

Right.

> Note this won't happen if you hook the close request and shutdown
> gracefully from the main thread.  All "real life" programs should be
> doing this anyway... but probably don't. (*ahem*)

Let me see if I understand this: I need to install a handler for the close 
request that sets a flag I need to check from my main code. I should not 
call exit() from the handler, since I assume this is what Allegro itself 
does, right?

> P.S. I don't think the default handling of close requests by forceful
> killing is right.  But that's fodder for post-4.0.2.

I agree. Since right now the only way it's going to do anything concretely 
useful is if I install my own handler. 
More generally though, without trapping the event in user code, the close 
button can never assure a clean shutdown, so IMHO the default handler 
should simply be to ignore the close request.
IIRC, this used to be the default at some point during the 3.9.xx WIP 
series. I don't really think it's a regression to change behavior that now 
results in a crash into an ignore, but as I said, that's just IMHO.

-- 
Evert Glebbeek
e-mail: eglebbk@xxxxxxxxxx   ICQ: 48210348
www: http://www.science.uva.nl/~eglebbk/ 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/