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

Derek Atkins warlord at MIT.EDU
Thu Jun 2 16:01:27 EDT 2005


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

> On Thu, Jun 02, 2005 at 01:44:29PM -0400, Derek Atkins wrote:
> > Quoting Chris Shoemaker <c.shoemaker at cox.net>:
> > 
> > > 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.
> > 
> > Yes, but all of that can happen before the gtk_widget_destroy() function
> > returns.
> > 
> 
> hmmm, I must be missing something.  Only a month without hacking GC
> and I'm confused already.  Time to crack the source open again.  I've
> been meaning to brush the dust off my budget patches anyway...

gtk_widget_destroy() "emits" the signal which calls the signal handler.  The
signal handler sets emits the CM event which calls the dialog CM destroy
handler which destroys the dialog context.   These are all function calls,
unless the CM has events turned off in which case the event will be cached for
later.

The events are not asynchronous.  Or at least, they don't HAVE to be..  They CAN
be synchronous and cause real-time function calls.  This means the CM event
handler can be called in the middle of the gtk_widget_destroy(), so the dialog
context can be destroyed before the gtk_widget_destroy() returns.

Does that make more sense?

> -chris

-derek
-- 
       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