]> git.0d.be Git - empathy.git/commitdiff
chat: use empathy_signal_connect_weak to connect signal on the buffer
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 18 Mar 2010 14:50:32 +0000 (15:50 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 29 Mar 2010 15:39:13 +0000 (17:39 +0200)
The textview can't survive once the EmpathyChat has been destroyed but if for
some reason its buffer it's still alive, firing this signal leads to a crash
(#612363).

libempathy-gtk/empathy-chat.c

index 23e85c8445de4044e83689007b437623f1de7344..36b4136ee40154d667c9c80c54c455b97c82fb79 100644 (file)
@@ -2252,9 +2252,9 @@ chat_create_ui (EmpathyChat *chat)
                          G_CALLBACK (chat_input_populate_popup_cb),
                          chat);
        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (chat->input_text_view));
                          G_CALLBACK (chat_input_populate_popup_cb),
                          chat);
        buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (chat->input_text_view));
-       g_signal_connect (buffer, "changed",
+       empathy_signal_connect_weak  (buffer, "changed",
                          G_CALLBACK (chat_input_text_buffer_changed_cb),
                          G_CALLBACK (chat_input_text_buffer_changed_cb),
-                         chat);
+                         G_OBJECT (chat));
        gtk_text_buffer_create_tag (buffer, "misspelled",
                                    "underline", PANGO_UNDERLINE_ERROR,
                                    NULL);
        gtk_text_buffer_create_tag (buffer, "misspelled",
                                    "underline", PANGO_UNDERLINE_ERROR,
                                    NULL);