[Gnucash-changes] Eliminate a double free of memory.

Derek Atkins warlord at MIT.EDU
Fri Jun 3 09:34:21 EDT 2005

Chris Shoemaker <c.shoemaker at cox.net> writes:

> Thanks for explaining.  I haven't looked at the details, but shouldn't
> destroy signal handler just generate the right CM event, and then the
> CM close handler for the cw structure actually frees cw.  I thought
> that was the intended use of the CM.

Actually, no, the CM is intended to trigger events when DATA OBJECTS
change, not when Windows change.  When a Data Object is destroyed it
signals a CM Close which should cause the window to get destroyed.
This is to handle things like you having an Account Window open and
then you decide to delete the account from the account tree.

So the Component Manager acts on Data Objects, which is exactly what
it's doing. When the CM sends a close event it triggers the gtk
destroy event.  The gtk destroy is what clears all the memory.

You never NEED to trigger a CM close.  You just need to gracefully
handle it.

> -chris


       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-devel mailing list