Re: GtkTextTag ref_count problem
- From: Jeff Franks <jcf tpg com au>
- To: Jeff Franks <jcf tpg com au>
- Cc: gtk-devel-list gnome org
- Subject: Re: GtkTextTag ref_count problem
- Date: Tue, 02 Apr 2002 15:06:08 +1000
Jeff Franks wrote:
Hi,
If Havoc reads this; I'm still finding problems with some GTK+
references not being unreferenced. This time its GtkTextTag.
Brief background for others:
I have written some C++ classes that wrap GTK+-2.0 objects. These C++
wrappers don't increase or decrease a GTK+ object's reference count;
that's left up to the user. However, a dynamic C++ wrapper's destruction
does depends on the wrapped GTK+ object being unreferenced, so that when
the reference count reaches zero a destroy-notifier function is called
which deletes the C++ wrapper. I put some code in place to track
operator new and operator delete calls to help identify possible memory
leaks. It just prints out at the name of all undeleted objects.
GtkTextTag problem:
I have noticed that GtkTextTag's C++ wrapper never gets deleted and have
tried to trace the problem. When a GtkTextBuffer is finalized it
unreferences its GtkTextTagTable. When the GtkTextTagTable is finalized
it calls the following line of code:
gtk_text_tag_table_foreach (table, foreach_unref, NULL);
which unreferences each tag in the table. At the start of this function
a tag has a reference count of 2 and after being unreferenced it still
has a reference count of 1. When you apply a tag the
'gtk_text_buffer_real_apply_tag()' function gets called. This calls
'_gtk_text_btree_tag()" which inturn calls
'gtk_text_btree_get_tag_info()' which increases the reference count of a
tag. Searching through the source code I couldn't find any where that
the tag gets unreferenced again, except for 'foreach_unref()' in
GtkTextTagTable. When I removed the line that increases the reference
count I found that GtkTextBuffer, GtkTextTagTable and GtkTextTag still
worked properly and the C++ wrappers were deleted.
Is this a bug or am I making a mistake somewhere?
Jeff.
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list
.
Sorry! This message was sent by mistake. Please ignore it.
Jeff.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]