[empathy] make sure that chat_window_contact_menu_update is not called recursively



commit 0ab3bd0797578847fe4f4967a3526333cb4a4e61
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Sep 27 14:27:58 2012 +0200

    make sure that chat_window_contact_menu_update is not called recursively
    
    Calling empathy_chat_get_contact_menu() may have as a side effect to call
    empathy_contact_set_persona() which will fire a 'notify' signal and so trigger
    another mennu update. There is no point doing a second one, and creating a
    second menu, so best to avoid recursive calls.

 src/empathy-chat-window.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index f21db03..8dec7c0 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -112,6 +112,8 @@ struct _EmpathyChatWindowPriv
   GSettings *gsettings_ui;
 
   EmpathySoundManager *sound_mgr;
+
+  gboolean updating_menu;
 };
 
 static GList *chat_windows = NULL;
@@ -598,6 +600,10 @@ chat_window_contact_menu_update (EmpathyChatWindow *self,
 {
   GtkWidget *menu, *submenu, *orig_submenu;
 
+  if (self->priv->updating_menu)
+    return;
+  self->priv->updating_menu = TRUE;
+
   menu = gtk_ui_manager_get_widget (self->priv->ui_manager,
     "/chats_menubar/menu_contact");
   orig_submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menu));
@@ -626,6 +632,8 @@ chat_window_contact_menu_update (EmpathyChatWindow *self,
           "notify::visible",
           (GCallback)_submenu_notify_visible_changed_cb, window, 0);
     }
+
+  self->priv->updating_menu = FALSE;
 }
 
 static guint



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