Reference counting for tree models doesn't behave the same way as for
contained components. The tree view adds an additional
reference to the model, so in your case your model is never destroyed as
the ref count is 2.
Try invoking:
g_object_unref(model) after you add it to the view.
My source fo
ABOUT WEAK_REFERENCES
I can't get g_object_weak_ref working, this is the (full) example I've
tried it on. It tryes to free a GDate which is in a gtktreemodel.
//
#include
#include
#include
void weak_ref (gpointer data, GObject *object) {
g_date_free (data);
Hi,
Matias Torres wrote:
> Hi all,
>
> I'm working on some simple app which only use gtk and sqlite libraries
> and i KNOW it's leaking memory.
> Would you please help me? (damn beatles!, i shouldn't be listening music
> when writing a mail!)
> *- Is there a way to pass a function to free certai
Have you tried a minimal example? Unfortunately I don't have access to
gtk-2.0 here, but here is a 1.2 sample that works:
#include
#include
#include
#include
static void weak_notify_test(gpointer the_data, GtkObject* o);
static void weak_notify_test(gpointer the_data, GtkObject* o){
int *
Thanks for answering. So basically...
(About the g_object_weak_ref)
GDate *date = g_date_new_dmy (1,1,2006);
GtkEntry *entry = gtk_entry_new ();
g_object_weak_ref (G_OBJECT (entry),
(GWeakNotify) g_date_free,
date);
After doing this
> *- Is there a way to pass a function to free certain struct in a
> GtkTreeModel so GTK frees the allocated space when the model's reference
> count reach to 0? (without registering it as a G_TYPE).*
>
One way is to register the struct as a "weak reference" to the model,
using g_object_wea