pan-devel
[Top][All Lists]
Advanced

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

Re: [Pan-devel] mem-leaks


From: Christophe Lambin
Subject: Re: [Pan-devel] mem-leaks
Date: 17 Jan 2003 23:25:17 +0100

Haran,

Took me a while, but I finally got around to committing these to CVS. 

Regarding freeing the unused tag: GtkTexTag is derived from GObject, so
I think the tag should be freed through g_object_unref().  Running this
through valgrind didn't report any problems, so I added this to your
patch.

Thanks for these patches.

Regards,
Christophe


On Mon, 2003-01-13 at 06:48, Haran Shivanan wrote:
> Module 'Christophe Lambin' core dumped on 12 Jan 2003 with the following 
> output
> 
> >
> > This patch still leaks tags when changing colours:
> > text_set_text_buffer_tags() allocates these unconditionally, so
> > gtk_text_tag_table_install() should free them when existing_tag==1.
> > Looking at the documentation for GtkTextTag, I see no destructor for
> > this data type. How should one free these?
> 
> Well, I found a couple of solutions but I'm not sure if they're correct
> because I'm a little shaky on GTK's reference counting policy.
> 
> First, I can explicitly do a g_free on the GtkTextTag object and this
> doesn't seem to cause any problems when I did some simple tests.
> 
> Second, instead of explicitly copying tag structure members when
> installing the new tags, I tried a
> 
> memcpy (new_tag, old_tag, sizeof(GtkTextTag);
> 
> and this also seems to work OK and should be more robust in case of
> changes to the internal members of the data structure.
> 
> However, will this screw up the refcounting system used by GTK?
> I don't think so but I'm not sure.
> 
> Any ideas?
> 
> Haran





reply via email to

[Prev in Thread] Current Thread [Next in Thread]