signal referencing

From: BRUGUIER Nicolas <>
Date: 18 Dec 2002 16:56:45 +0100


First, thank you for this great tools which is gob

I use gob 2.0.4 and i have a some troubles with ref and unref object
when I use signal,

I have an object who generate signal

class MyObject from G:Object
        private gchar * my_string
                destroy {

        signal NONE (NONE)

        public SELF *
                selfp->my_string = g_strdup("my_string");

        public void

and an other who use this:

on_my_signal(MyObject * obj, gpointer user_data)
        my_signal = TRUE;

        MyObject * obj = my_object_new();

        my_object_connect__mysignal(obj, on_my_signal, NULL);
        while (!my_signal);

the problem is when the signal is send MyObject is referenced, I saw it
with my favorite debugger.

Well, when I am in on_my_signal obj->ref_count = 2, OK I add
g_object_unref in end of on_my_signal but in this case if the signal
isn't connected the ref count it is always increase. The only solution i
found is decrease ref_count with g_object_unref after call the signal

My question what is the better solution or does have another solutions ?

thank you, in advance, and sorry for my english


BRUGUIER Nicolas <>
Received on Wed Dec 18 2002 - 10:57:13 CST

This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:05:02 CDT