Bug 16774 - TpConnectionManager idle callback not cancelled on destroy
Summary: TpConnectionManager idle callback not cancelled on destroy
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-glib (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2008-07-18 05:36 UTC by Simon McVittie
Modified: 2008-09-02 05:50 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch to store the idle ids and remove them from queue on destruct (3.04 KB, patch)
2008-07-18 08:55 UTC, Sunil Mohan Adapa
Details | Splinter Review

Description Simon McVittie 2008-07-18 05:36:48 UTC
As reported by iain^ on IRC, TpConnectionManager fails to cancel an idle when destroyed, resulting in this crash.

#include <telepathy-glib/dbus.h>
#include <telepathy-glib/connection-manager.h>

DBusGConnection *conn;

TpDBusDaemon *tp_conn;

static void
list_cm (TpConnectionManager * const *cms,
         gsize                        n_cms,
         const GError                *error,
         gpointer                     userdata,
         GObject                     *weak_object)
{
        int i;

        g_print ("Got %d connection managers\n", n_cms);
        for (i = 0; i < n_cms; i++) {
                TpConnectionManager *cm = cms[i];

                g_print ("[%d] %s\n", i + 1, cm->name);

                if (cm->info_source > TP_CM_INFO_SOURCE_NONE) {
                        int j;

                        for (j = 0; cm->protocols[j]; j++) {
                                const TpConnectionManagerProtocol *p = cm->protocols[j];
                                g_print ("   (%d) %s\n", j + 1, p->name);
                        }
                }
        }
}

int
main (int    argc,
      char **argv)
{
        GMainLoop *mainloop;

        g_type_init ();

        conn = tp_get_bus ();
        tp_conn = tp_dbus_daemon_new (conn);

        tp_list_connection_managers (tp_conn, list_cm, NULL, NULL, NULL);

        mainloop = g_main_loop_new (NULL, FALSE);
        g_main_loop_run (mainloop);
}

-----
# ./tp-test
Got 2 connection managers
[1] gabble
[2] sofiasip

(process:13565): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `TpConnectionManager'
Segmentation fault

Program received signal SIGSEGV, Segmentation fault.
0x4007bb5e in tp_connection_manager_idle_read_manager_file (data=0x8058808)
    at connection-manager.c:808
808	  if (self->priv->protocols == NULL && self->priv->manager_file != NULL
(gdb) bt
#0  0x4007bb5e in tp_connection_manager_idle_read_manager_file (data=0x8058808)
    at connection-manager.c:808
#1  0x4027ddf1 in g_idle_dispatch (source=0x80590c0, 
    callback=0x403179c8 <g_threads_got_initialized>, user_data=0x8058808)
    at gmain.c:4171
#2  0x4027f9fc in IA__g_main_context_dispatch (context=0x8051668)
    at gmain.c:2066
#3  0x40282e5f in g_main_context_iterate (context=0x8051668, block=1, 
    dispatch=1, self=0x8053000) at gmain.c:2699
#4  0x40283209 in IA__g_main_loop_run (loop=0x8051510) at gmain.c:2922
#5  0x080487a3 in main () at main.c:48
Comment 1 Sunil Mohan Adapa 2008-07-18 08:55:07 UTC
Created attachment 17747 [details] [review]
Patch to store the idle ids and remove them from queue on destruct

I had a crash in telepathy-glib for the same reason. The attached patch fixed the crash for me.
Comment 2 Simon McVittie 2008-07-18 09:13:18 UTC
The patch looks good, thanks. I'll convert it to Telepathy coding style and incorporate it in 0.7.12, probably later today.
Comment 3 Simon McVittie 2008-09-02 05:50:57 UTC
Fixed in 0.7.12, I believe.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.