Antwort: Re: SIGTRAP when sending signal on closing dbus connection



Hi Simon,

thank you :)

> In the specific case of GDBus it is actually OK to use the same
> GDBusConnection from different threads.


Yes, it's also documented.

> As a general rule, you should never do anything with a pointer if you
> cannot know that the object it points to is not going to be freed by
> another thread.


Oh, you are right! Somehow, I was totally mixed up! But I guess, I figured out what disturbed me:  
For sure it is a bad idea to use the object, if the timing is like this:

1. g_object_unref(conn);
2. g_dbus_connection_emit_signal(conn); => Object is already freed. User deserves the crash ;)

But what is, if the timing is like this:

1. g_dbus_connection_emit_signal(conn);
2. g_object_unref(conn);

I haven't seen that the "g_dbus_connection_emit_signal"obtains a reference to the connection!
Shouldn't it do so, to be sure that the connection is not freed "during" the call?

Best regards
Jean-Pierre


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