rpms/empathy/F-12 0001-empathy-protocol-chooser-don-t-cache-TpConnectionMan.patch, NONE, 1.1 0002-empathy-chat-window-Don-t-update-the-Contact-menu-if.patch, NONE, 1.1 0003-Fix-crash-when-joining-a-chat-GTK_WIDGET_VISIBLE-is-.patch, NONE, 1.1 empathy.spec, 1.82, 1.83

Matthias Clasen mclasen at fedoraproject.org
Mon Oct 26 00:15:25 UTC 2009


Author: mclasen

Update of /cvs/pkgs/rpms/empathy/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv15778

Modified Files:
	empathy.spec 
Added Files:
	0001-empathy-protocol-chooser-don-t-cache-TpConnectionMan.patch 
	0002-empathy-chat-window-Don-t-update-the-Contact-menu-if.patch 
	0003-Fix-crash-when-joining-a-chat-GTK_WIDGET_VISIBLE-is-.patch 
Log Message:
Some crash fixes


0001-empathy-protocol-chooser-don-t-cache-TpConnectionMan.patch:
 empathy-protocol-chooser.c |   76 +++++++++++++++++++++++++++------------------
 1 file changed, 47 insertions(+), 29 deletions(-)

--- NEW FILE 0001-empathy-protocol-chooser-don-t-cache-TpConnectionMan.patch ---
>From 9ad94f9f96cb1b7aa438d264a6b8989279add8fd Mon Sep 17 00:00:00 2001
From: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date: Fri, 23 Oct 2009 11:17:23 +0100
Subject: [PATCH 1/4] empathy-protocol-chooser: don't cache TpConnectionManagerProtocol in the store

TpConnectionManagerProtocol are not garanteed to stay valid so we
shouldn't cache them in the store. Instead, we cache the protocol name
and call tp_connection_manager_get_protocol each time we need it.
This should fix crashers as the ones reported in #599386.
---
 libempathy-gtk/empathy-protocol-chooser.c |   75 ++++++++++++++++++-----------
 1 files changed, 47 insertions(+), 28 deletions(-)

diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c
index 62fedaf..9c48917 100644
--- a/libempathy-gtk/empathy-protocol-chooser.c
+++ b/libempathy-gtk/empathy-protocol-chooser.c
@@ -76,7 +76,7 @@ enum
   COL_ICON,
   COL_LABEL,
   COL_CM,
-  COL_PROTOCOL,
+  COL_PROTOCOL_NAME,
   COL_IS_GTALK,
   COL_COUNT
 };
@@ -85,7 +85,7 @@ G_DEFINE_TYPE (EmpathyProtocolChooser, empathy_protocol_chooser,
     GTK_TYPE_COMBO_BOX);
 
 static gint
-protocol_chooser_sort_protocol_value (TpConnectionManagerProtocol *protocol)
+protocol_chooser_sort_protocol_value (const gchar *protocol_name)
 {
   guint i;
   const gchar *names[] = {
@@ -97,7 +97,7 @@ protocol_chooser_sort_protocol_value (TpConnectionManagerProtocol *protocol)
 
   for (i = 0 ; names[i]; i++)
     {
-      if (strcmp (protocol->name, names[i]) == 0)
+      if (strcmp (protocol_name, names[i]) == 0)
         return i;
     }
 
@@ -110,22 +110,22 @@ protocol_chooser_sort_func (GtkTreeModel *model,
     GtkTreeIter  *iter_b,
     gpointer      user_data)
 {
-  TpConnectionManagerProtocol *protocol_a;
-  TpConnectionManagerProtocol *protocol_b;
+  gchar *protocol_a;
+  gchar *protocol_b;
   gint cmp = 0;
 
   gtk_tree_model_get (model, iter_a,
-      COL_PROTOCOL, &protocol_a,
+      COL_PROTOCOL_NAME, &protocol_a,
       -1);
   gtk_tree_model_get (model, iter_b,
-      COL_PROTOCOL, &protocol_b,
+      COL_PROTOCOL_NAME, &protocol_b,
       -1);
 
   cmp = protocol_chooser_sort_protocol_value (protocol_a);
   cmp -= protocol_chooser_sort_protocol_value (protocol_b);
   if (cmp == 0)
     {
-      cmp = strcmp (protocol_a->name, protocol_b->name);
+      cmp = strcmp (protocol_a, protocol_b);
       /* only happens for jabber where there is one entry for gtalk and one for
        * non-gtalk */
       if (cmp == 0)
@@ -139,6 +139,8 @@ protocol_chooser_sort_func (GtkTreeModel *model,
         }
     }
 
+  g_free (protocol_a);
+  g_free (protocol_b);
   return cmp;
 }
 
@@ -169,7 +171,6 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
         {
           GtkTreeIter titer;
           gboolean valid;
-          const TpConnectionManagerProtocol *haze_proto;
           TpConnectionManager *haze_cm;
 
           /* let's this CM replace the haze implementation */
@@ -178,28 +179,26 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
 
           while (valid)
             {
+              gchar *haze_proto_name = NULL;
+
               gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &titer,
-                  COL_PROTOCOL, &haze_proto,
+                  COL_PROTOCOL_NAME, &haze_proto_name,
                   COL_CM, &haze_cm, -1);
 
               if (haze_cm == NULL)
                 continue;
 
-              if (haze_proto == NULL)
-                {
-                  g_object_unref (haze_cm);
-                  continue;
-                }
-
               if (!tp_strdiff (haze_cm->name, "haze") &&
-                  !tp_strdiff (haze_proto->name, proto->name))
+                  !tp_strdiff (haze_proto_name, proto->name))
                 {
                   gtk_list_store_remove (priv->store, &titer);
                   g_object_unref (haze_cm);
+                  g_free (haze_proto_name);
                   break;
                 }
 
               g_object_unref (haze_cm);
+              g_free (haze_proto_name);
               valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store),
                   &titer);
             }
@@ -219,7 +218,7 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
           COL_ICON, icon_name,
           COL_LABEL, display_name,
           COL_CM, cm,
-          COL_PROTOCOL, proto,
+          COL_PROTOCOL_NAME, proto->name,
           COL_IS_GTALK, FALSE,
           -1);
 
@@ -232,7 +231,7 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser,
              COL_ICON, "im-google-talk",
              COL_LABEL, display_name,
              COL_CM, cm,
-             COL_PROTOCOL, proto,
+             COL_PROTOCOL_NAME, proto->name,
              COL_IS_GTALK, TRUE,
              -1);
         }
@@ -278,16 +277,16 @@ protocol_chooser_constructed (GObject *object)
           G_TYPE_STRING,    /* Icon name */
           G_TYPE_STRING,    /* Label     */
           G_TYPE_OBJECT,    /* CM */
-          G_TYPE_POINTER,   /* protocol   */
+          G_TYPE_STRING,    /* protocol name  */
           G_TYPE_BOOLEAN);  /* is gtalk  */
 
   /* Set the protocol sort function */
   gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (priv->store),
-      COL_PROTOCOL,
+      COL_PROTOCOL_NAME,
       protocol_chooser_sort_func,
       NULL, NULL);
   gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (priv->store),
-      COL_PROTOCOL,
+      COL_PROTOCOL_NAME,
       GTK_SORT_ASCENDING);
 
   gtk_combo_box_set_model (GTK_COMBO_BOX (object),
@@ -394,17 +393,30 @@ protocol_chooser_filter_visible_func (GtkTreeModel *model,
   EmpathyProtocolChooser *protocol_chooser = user_data;
   EmpathyProtocolChooserPriv *priv = GET_PRIV (protocol_chooser);
   TpConnectionManager *cm = NULL;
-  TpConnectionManagerProtocol *protocol = NULL;
+  gchar *protocol_name = NULL;
   gboolean visible = FALSE;
 
-  gtk_tree_model_get (model, iter, COL_CM, &cm, COL_PROTOCOL, &protocol, -1);
+  gtk_tree_model_get (model, iter,
+      COL_CM, &cm,
+      COL_PROTOCOL_NAME, &protocol_name,
+      -1);
 
-  if (cm != NULL && protocol != NULL)
+  if (cm != NULL && protocol_name != NULL)
     {
-      visible = priv->filter_func (cm, protocol, priv->filter_user_data);
-      g_object_unref (cm);
+      TpConnectionManagerProtocol *protocol;
+
+      protocol = (TpConnectionManagerProtocol *)
+        tp_connection_manager_get_protocol (cm, protocol_name);
+
+      if (protocol != NULL)
+        {
+          visible = priv->filter_func (cm, protocol, priv->filter_user_data);
+        }
     }
 
+  if (cm != NULL)
+    g_object_unref (cm);
+
   return visible;
 }
 
@@ -444,9 +456,16 @@ empathy_protocol_chooser_dup_selected (
 
       if (protocol != NULL)
         {
+          gchar *protocol_name = NULL;
+
           gtk_tree_model_get (GTK_TREE_MODEL (cur_model), &iter,
-              COL_PROTOCOL, protocol,
+              COL_PROTOCOL_NAME, &protocol_name,
               -1);
+
+          *protocol = (TpConnectionManagerProtocol *)
+            tp_connection_manager_get_protocol (cm, protocol_name);
+
+          g_free (protocol_name);
         }
 
       if (is_gtalk != NULL)
-- 
1.6.5.1


0002-empathy-chat-window-Don-t-update-the-Contact-menu-if.patch:
 empathy-chat-window.c |   32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

--- NEW FILE 0002-empathy-chat-window-Don-t-update-the-Contact-menu-if.patch ---
>From 2331c9bf7995be07797a42c3ebc3f91aa03db529 Mon Sep 17 00:00:00 2001
From: Rob Bradford <rob at linux.intel.com>
Date: Fri, 23 Oct 2009 17:18:05 +0100
Subject: [PATCH 2/4] empathy-chat-window: Don't update the Contact menu if visible

If the Contact menu is currently visible do not update it. Instead update it
once the menu is hidden.

Fixes: #591360
---
 src/empathy-chat-window.c |   31 ++++++++++++++++++++++++++-----
 1 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 9e89f75..382e293 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -113,6 +113,8 @@ static const GtkTargetEntry drag_types_dest[] = {
 	{ "GTK_NOTEBOOK_TAB", GTK_TARGET_SAME_APP, DND_DRAG_TYPE_TAB },
 };
 
+static void chat_window_update (EmpathyChatWindow *window);
+
 G_DEFINE_TYPE (EmpathyChatWindow, empathy_chat_window, G_TYPE_OBJECT);
 
 static void
@@ -295,6 +297,17 @@ chat_window_create_label (EmpathyChatWindow *window,
 }
 
 static void
+_submenu_notify_visible_changed_cb (GObject    *object,
+				    GParamSpec *pspec,
+				    gpointer    userdata)
+{
+	g_signal_handlers_disconnect_by_func (object,
+					      _submenu_notify_visible_changed_cb,
+					      userdata);
+	chat_window_update (EMPATHY_CHAT_WINDOW (userdata));
+}
+
+static void
 chat_window_update (EmpathyChatWindow *window)
 {
 	EmpathyChatWindowPriv *priv = GET_PRIV (window);
@@ -311,8 +324,7 @@ chat_window_update (EmpathyChatWindow *window)
 	gboolean               avatar_in_icon;
 	GtkWidget             *chat;
 	GtkWidget             *chat_close_button;
-	GtkWidget             *submenu;
-	GtkWidget             *menu;
+	GtkWidget             *menu, *submenu, *orig_submenu;
 
 	/* Get information */
 	page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (priv->notebook));
@@ -336,9 +348,18 @@ chat_window_update (EmpathyChatWindow *window)
 	/* Update Contact menu */
 	menu = gtk_ui_manager_get_widget (priv->ui_manager,
 		"/chats_menubar/menu_contact");
-	submenu = empathy_chat_get_contact_menu (priv->current_chat);
-	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), submenu);
-	gtk_widget_show (menu);
+	orig_submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));
+	if (!GTK_WIDGET_VISIBLE (orig_submenu))
+	{
+		submenu = empathy_chat_get_contact_menu (priv->current_chat);
+		gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), submenu);
+		gtk_widget_show (menu);
+	} else {
+		empathy_signal_connect_weak (orig_submenu,
+					     "notify::visible",
+					     (GCallback)_submenu_notify_visible_changed_cb,
+					     G_OBJECT (window));
+	}
 
 	/* Update window title */
 	if (n_chats == 1) {
-- 
1.6.5.1


0003-Fix-crash-when-joining-a-chat-GTK_WIDGET_VISIBLE-is-.patch:
 empathy-chat-window.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- NEW FILE 0003-Fix-crash-when-joining-a-chat-GTK_WIDGET_VISIBLE-is-.patch ---
>From 024768c3ddf14234bb9ee7a8d4ab585aa4de0a3a Mon Sep 17 00:00:00 2001
From: Xavier Claessens <xclaesse at gmail.com>
Date: Sun, 25 Oct 2009 17:54:49 +0100
Subject: [PATCH 3/4] Fix crash when joining a chat, GTK_WIDGET_VISIBLE is not NULL-safe

---
 src/empathy-chat-window.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 382e293..985fa88 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -349,8 +349,7 @@ chat_window_update (EmpathyChatWindow *window)
 	menu = gtk_ui_manager_get_widget (priv->ui_manager,
 		"/chats_menubar/menu_contact");
 	orig_submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));
-	if (!GTK_WIDGET_VISIBLE (orig_submenu))
-	{
+	if (orig_submenu == NULL || !GTK_WIDGET_VISIBLE (orig_submenu)) {
 		submenu = empathy_chat_get_contact_menu (priv->current_chat);
 		gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), submenu);
 		gtk_widget_show (menu);
-- 
1.6.5.1



Index: empathy.spec
===================================================================
RCS file: /cvs/pkgs/rpms/empathy/F-12/empathy.spec,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -p -r1.82 -r1.83
--- empathy.spec	19 Oct 2009 23:17:58 -0000	1.82
+++ empathy.spec	26 Oct 2009 00:15:24 -0000	1.83
@@ -14,7 +14,7 @@
 
 Name:		empathy
 Version:	2.28.1
-Release:	1%{?dist}
+Release:	2%{?dist}
 Summary:	Instant Messaging Client for GNOME
 
 Group:		Applications/Communications
@@ -33,6 +33,10 @@ Patch1:		%{name}-broken-pkgconfig.patch
 # http://bugzilla.gnome.org/show_bug.cgi?id=592853
 Patch3:		presence-icons.patch
 Patch5:		%{name}-broken-nm.patch
+# upstream crash fixes
+Patch6: 0001-empathy-protocol-chooser-don-t-cache-TpConnectionMan.patch
+Patch7: 0002-empathy-chat-window-Don-t-update-the-Contact-menu-if.patch
+Patch8: 0003-Fix-crash-when-joining-a-chat-GTK_WIDGET_VISIBLE-is-.patch
 
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -137,6 +141,9 @@ bindings to the libempathy and libempath
 %patch1 -p1 -b .pkgconfig
 %patch3 -p1 -b .presence-icons
 %patch5 -p1 -b .nm
+%patch6 -p1 -b .dont-cache-conman
+%patch7 -p1 -b .dont-update-contacts
+%patch8 -p1 -b .join-chat-crash
 
 # force these to be regenerated
 rm data/empathy.desktop
@@ -245,6 +252,9 @@ fi
 %{python_sitearch}/empathy*.so
 
 %changelog
+* Sun Oct 25 2009 Matthias Clasen <mclasen at redhat.com> - 2.28.1-2
+- Include a number of crash fixes from the stable branch
+
 * Mon Oct 19 2009 Brian Pepple <bpepple at fedoraproject.org> - 2.28.1-1
 - Update to 2.28.1.
 - Drop no-settings patch.  Fixed upstream.




More information about the fedora-extras-commits mailing list