From 08d5bdcf8b8bef913c9ad175927d528ff432332f Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 12 Apr 2013 15:55:28 -0400 Subject: Add e_cal_model_ref_default_client(). Replaces e_cal_model_get_default_client(), which was not thread-safe. --- modules/calendar/e-memo-shell-view-actions.c | 6 ++++-- modules/calendar/e-memo-shell-view-private.c | 4 +++- modules/calendar/e-task-shell-view-actions.c | 6 ++++-- modules/calendar/e-task-shell-view-private.c | 4 +++- 4 files changed, 14 insertions(+), 6 deletions(-) (limited to 'modules/calendar') diff --git a/modules/calendar/e-memo-shell-view-actions.c b/modules/calendar/e-memo-shell-view-actions.c index 5e30e24fcf..f0c16bb99a 100644 --- a/modules/calendar/e-memo-shell-view-actions.c +++ b/modules/calendar/e-memo-shell-view-actions.c @@ -387,12 +387,12 @@ action_memo_new_cb (GtkAction *action, ECalModel *model; model = e_memo_table_get_model (memo_table); - client = e_cal_model_get_default_client (model); + client = e_cal_model_ref_default_client (model); } else { ECalModelComponent *comp_data; comp_data = list->data; - client = comp_data->client; + client = g_object_ref (comp_data->client); g_slist_free (list); } @@ -406,6 +406,8 @@ action_memo_new_cb (GtkAction *action, gtk_window_present (GTK_WINDOW (editor)); g_object_unref (comp); + + g_object_unref (client); } static void diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c index 50b9e5f8aa..a84a44134d 100644 --- a/modules/calendar/e-memo-shell-view-private.c +++ b/modules/calendar/e-memo-shell-view-private.c @@ -37,11 +37,13 @@ memo_shell_view_model_row_appended_cb (EMemoShellView *memo_shell_view, /* This is the "Click to Add" handler. */ - client = e_cal_model_get_default_client (model); + client = e_cal_model_ref_default_client (model); source = e_client_get_source (E_CLIENT (client)); memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar; e_memo_shell_sidebar_add_source (memo_shell_sidebar, source); + + g_object_unref (client); } static void diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c index 0c3ab2e040..5102def69b 100644 --- a/modules/calendar/e-task-shell-view-actions.c +++ b/modules/calendar/e-task-shell-view-actions.c @@ -456,12 +456,12 @@ action_task_new_cb (GtkAction *action, ECalModel *model; model = e_task_table_get_model (task_table); - client = e_cal_model_get_default_client (model); + client = e_cal_model_ref_default_client (model); } else { ECalModelComponent *comp_data; comp_data = list->data; - client = comp_data->client; + client = g_object_ref (comp_data->client); g_slist_free (list); } @@ -474,6 +474,8 @@ action_task_new_cb (GtkAction *action, gtk_window_present (GTK_WINDOW (editor)); g_object_unref (comp); + + g_object_unref (client); } static void diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c index bc538c6e75..a3e29c9ad3 100644 --- a/modules/calendar/e-task-shell-view-private.c +++ b/modules/calendar/e-task-shell-view-private.c @@ -37,11 +37,13 @@ task_shell_view_model_row_appended_cb (ETaskShellView *task_shell_view, /* This is the "Click to Add" handler. */ - client = e_cal_model_get_default_client (model); + client = e_cal_model_ref_default_client (model); source = e_client_get_source (E_CLIENT (client)); task_shell_sidebar = task_shell_view->priv->task_shell_sidebar; e_task_shell_sidebar_add_source (task_shell_sidebar, source); + + g_object_unref (client); } static gboolean -- cgit v1.2.3