Re: GTK_OBJECT_DESTROYED



On Sat, Nov 17, 2001 at 08:23:47PM -0500, Owen Taylor wrote:
[...]
> Checking the DESTROYED flag is then not useful any more, but worse
> uses of GTK_OBJECT_DESTROYED() probably indicates code that is
> assuming that it can detect whether the object has been previously
> been destroyed with this flag.
> 
> Basically, uses of GTK_OBJECT_DESTROYED() probably indicate one of two
> things:
> 
>  a) The caller wants to make sure they don't accidentally 
>     segfault the object by trying to access freed memory
>     or other no longer valid state in the widget.

You seem to indicate that this will still work (in the
"GTK_OBJECT_DESTROYED is deprecated" world). But if the DESTROYED flag
has been cleared, it won't, will it? I think I'm confused here. :(

[...]
> Unfortunately, these uses usually seem to be in places where people
> had reentrancy problems, couldn't figure out what was going on and
> added GTK_OBJECT_DESTROYED() as a band-aid. In the few I've looked at,
> it is not at all obvious whether GTK_OBJECT_DESTROYED() doing nothing
> presents a problem or not.
> 
> So, if you've used GTK_OBJECT_DESTROYED(), I'd appreciate it if you'd
> take a look back at your code and see what's the case for that usage.

There are half a dozen in gnorpm where this is used because window A
would throw up window B to do something else, then the user would close
window A forcefully, while window B would close at the end of "something
else" and continue back in the routine that writes to window A and ...
oops. :(

This can probably be worked around by more intelligent handling of the
::destroy signal (and generally more intelligent data flow), so it's
probably not a huge deal, but right now those calls are necessary (they
fixed a couple of hundred bugs).

Deathmarch mode for me at work is over now, so I'm getting back into
Gnome work a bit more. I can therefore work out this specific example on
IRC with some unwilling volunteers, but I just thought I'd throw it up
as an example of where it seems to be used legitimately in 1.2 (I was
following Havoc's advice, honest!).

> My basic opinion is that we probably should remove this macro
> entirely...  I wouldn't trust any code that was using
> GTK_OBJECT_DESTROYED() now unless I had carefully checked through it
> and figured out why it was being used. Leaving it there and
> non-functional is just turning an immediate painful code reading task
> into a delayed but even more painful task in debugging.

Yet another item on the "things to rewrite" list, nothing more drastic
than that.

Malcolm

-- 
The colder the x-ray table, the more of your body is required on it.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]