aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-main-window.c
diff options
context:
space:
mode:
authorTravis Reitter <travis.reitter@collabora.co.uk>2010-10-14 02:36:05 +0800
committerTravis Reitter <travis.reitter@collabora.co.uk>2010-10-16 05:14:45 +0800
commit2c5175128196c93f648b165bc7e155f5d9cef1c3 (patch)
treef557ea7b16cffc5727c3d8f5f1304c2017309e09 /src/empathy-main-window.c
parent1291ec05478f211d37479fc98904d9d3dda743b0 (diff)
downloadgsoc2013-empathy-2c5175128196c93f648b165bc7e155f5d9cef1c3.tar
gsoc2013-empathy-2c5175128196c93f648b165bc7e155f5d9cef1c3.tar.gz
gsoc2013-empathy-2c5175128196c93f648b165bc7e155f5d9cef1c3.tar.bz2
gsoc2013-empathy-2c5175128196c93f648b165bc7e155f5d9cef1c3.tar.lz
gsoc2013-empathy-2c5175128196c93f648b165bc7e155f5d9cef1c3.tar.xz
gsoc2013-empathy-2c5175128196c93f648b165bc7e155f5d9cef1c3.tar.zst
gsoc2013-empathy-2c5175128196c93f648b165bc7e155f5d9cef1c3.zip
Retain the ContactManager for the lifetime of the main window.
The ContactManager doesn't cleanly disconnect its signals when it's finalized (or initialized), so we need to retain it for the lifetime of the main window to avoid segfaults. It's not worth fixing the ContactManager, since we're planning to remove it.
Diffstat (limited to 'src/empathy-main-window.c')
-rw-r--r--src/empathy-main-window.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index 85a64a365..a89ba1cf1 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -101,6 +101,7 @@ G_DEFINE_TYPE (EmpathyMainWindow, empathy_main_window, GTK_TYPE_WINDOW);
#define GET_PRIV(self) ((EmpathyMainWindowPriv *)((EmpathyMainWindow *) self)->priv)
struct _EmpathyMainWindowPriv {
+ EmpathyContactList *contact_manager;
EmpathyIndividualStore *individual_store;
EmpathyIndividualView *individual_view;
TpAccountManager *account_manager;
@@ -695,6 +696,7 @@ empathy_main_window_finalize (GObject *window)
g_object_unref (priv->account_manager);
g_object_unref (priv->individual_store);
+ g_object_unref (priv->contact_manager);
g_hash_table_destroy (priv->errors);
/* disconnect all handlers of status-changed signal */
@@ -1536,7 +1538,6 @@ static void
empathy_main_window_init (EmpathyMainWindow *window)
{
EmpathyMainWindowPriv *priv;
- EmpathyContactList *list_iface;
EmpathyIndividualManager *individual_manager;
GtkBuilder *gui;
GtkWidget *sw;
@@ -1676,7 +1677,12 @@ empathy_main_window_init (EmpathyMainWindow *window)
gtk_container_add (GTK_CONTAINER (item), priv->throbber);
priv->throbber_tool_item = GTK_WIDGET (item);
- list_iface = EMPATHY_CONTACT_LIST (empathy_contact_manager_dup_singleton ());
+ /* XXX: this class is designed to live for the duration of the program,
+ * so it's got a race condition between its signal handlers and its
+ * finalization. The class is planned to be removed, so we won't fix
+ * this before then. */
+ priv->contact_manager = EMPATHY_CONTACT_LIST (
+ empathy_contact_manager_dup_singleton ());
individual_manager = empathy_individual_manager_dup_singleton ();
priv->individual_store = empathy_individual_store_new (
individual_manager);
@@ -1691,11 +1697,9 @@ empathy_main_window_init (EmpathyMainWindow *window)
EMPATHY_INDIVIDUAL_FEATURE_ALL);
priv->butterfly_log_migration_members_changed_id = g_signal_connect (
- list_iface, "members-changed",
+ priv->contact_manager, "members-changed",
G_CALLBACK (main_window_members_changed_cb), window);
- g_object_unref (list_iface);
-
gtk_widget_show (GTK_WIDGET (priv->individual_view));
gtk_container_add (GTK_CONTAINER (sw),
GTK_WIDGET (priv->individual_view));