[evolution] Bug #678476 - Critical warnings on calendar factory console



commit b97a43817982d259244eae23130feec890955929
Author: Milan Crha <mcrha redhat com>
Date:   Tue Aug 21 17:52:31 2012 +0200

    Bug #678476 - Critical warnings on calendar factory console

 calendar/gui/e-cal-model.c              |   10 ++++++++--
 modules/calendar/e-cal-shell-sidebar.c  |   16 ++++++++++++++++
 modules/calendar/e-memo-shell-sidebar.c |   16 ++++++++++++++++
 modules/calendar/e-task-shell-sidebar.c |   16 ++++++++++++++++
 4 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 246d3dc..8de4244 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -3438,7 +3438,10 @@ e_cal_model_set_search_query (ECalModel *model,
 	if (priv->search_sexp)
 		g_free (priv->search_sexp);
 
-	priv->search_sexp = g_strdup (sexp);
+	if (!sexp || !*sexp)
+		priv->search_sexp = NULL;
+	else
+		priv->search_sexp = g_strdup (sexp);
 
 	redo_queries (model);
 }
@@ -3463,7 +3466,10 @@ e_cal_model_set_search_query_with_time_range (ECalModel *model,
 		if (priv->search_sexp)
 			g_free (priv->search_sexp);
 
-		priv->search_sexp = g_strdup (sexp);
+		if (!sexp || !*sexp)
+			priv->search_sexp = NULL;
+		else
+			priv->search_sexp = g_strdup (sexp);
 		do_query = TRUE;
 	}
 
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index 1f4ab02..d734b21 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -61,6 +61,8 @@ struct _ECalShellSidebarPrivate {
 	 * which is bound by an EBinding to ECalModel. */
 	ECalClient *default_client;
 
+	ESource *loading_default_source_instance; /* not-reffed, only for comparison */
+
 	GCancellable *loading_default_client;
 	GCancellable *loading_clients;
 };
@@ -368,6 +370,14 @@ cal_shell_sidebar_default_loaded_cb (GObject *source_object,
 
 	e_client_utils_open_new_finish (source, result, &client, &error);
 
+	if (priv->loading_default_client) {
+		g_object_unref (priv->loading_default_client);
+		priv->loading_default_client = NULL;
+	}
+
+	if (source == priv->loading_default_source_instance)
+		priv->loading_default_source_instance = NULL;
+
 	/* Ignore cancellations. */
 	if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
 	    g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
@@ -412,6 +422,10 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
 
 	priv = cal_shell_sidebar->priv;
 
+	/* already loading that source as default source */
+	if (source == priv->loading_default_source_instance)
+		return;
+
 	/* FIXME Sidebar should not be accessing the EShellContent.
 	 *       This probably needs to be moved to ECalShellView. */
 	shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar);
@@ -436,6 +450,8 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
 		return;
 	}
 
+	/* it's only for pointer comparison, no need to ref it */
+	priv->loading_default_source_instance = source;
 	priv->loading_default_client = g_cancellable_new ();
 
 	e_client_utils_open_new (
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index f7cbea9..f59e0a8 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -57,6 +57,8 @@ struct _EMemoShellSidebarPrivate {
 	 * which is bound by an EBinding to ECalModel. */
 	ECalClient *default_client;
 
+	ESource *loading_default_source_instance; /* not-reffed, only for comparison */
+
 	GCancellable *loading_default_client;
 	GCancellable *loading_clients;
 };
@@ -363,6 +365,14 @@ memo_shell_sidebar_default_loaded_cb (GObject *source_object,
 
 	e_client_utils_open_new_finish (source, result, &client, &error);
 
+	if (priv->loading_default_client) {
+		g_object_unref (priv->loading_default_client);
+		priv->loading_default_client = NULL;
+	}
+
+	if (source == priv->loading_default_source_instance)
+		priv->loading_default_source_instance = NULL;
+
 	/* Ignore cancellations. */
 	if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
 	    g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
@@ -407,6 +417,10 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
 
 	priv = memo_shell_sidebar->priv;
 
+	/* already loading that source as default source */
+	if (source == priv->loading_default_source_instance)
+		return;
+
 	/* FIXME Sidebar should not be accessing the EShellContent.
 	 *       This probably needs to be moved to EMemoShellView. */
 	shell_sidebar = E_SHELL_SIDEBAR (memo_shell_sidebar);
@@ -431,6 +445,8 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
 		return;
 	}
 
+	/* it's only for pointer comparison, no need to ref it */
+	priv->loading_default_source_instance = source;
 	priv->loading_default_client = g_cancellable_new ();
 
 	e_client_utils_open_new (
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index 1be397e..1653fe2 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -57,6 +57,8 @@ struct _ETaskShellSidebarPrivate {
 	 * which is bound by an EBinding to ECalModel. */
 	ECalClient *default_client;
 
+	ESource *loading_default_source_instance; /* not-reffed, only for comparison */
+
 	GCancellable *loading_default_client;
 	GCancellable *loading_clients;
 };
@@ -363,6 +365,14 @@ task_shell_sidebar_default_loaded_cb (GObject *source_object,
 
 	e_client_utils_open_new_finish (source, result, &client, &error);
 
+	if (priv->loading_default_client) {
+		g_object_unref (priv->loading_default_client);
+		priv->loading_default_client = NULL;
+	}
+
+	if (source == priv->loading_default_source_instance)
+		priv->loading_default_source_instance = NULL;
+
 	/* Ignore cancellations. */
 	if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
 	    g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
@@ -407,6 +417,10 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
 
 	priv = task_shell_sidebar->priv;
 
+	/* already loading that source as default source */
+	if (source == priv->loading_default_source_instance)
+		return;
+
 	/* FIXME Sidebar should not be accessing the EShellContent.
 	 *       This probably needs to be moved to ETaskShellView. */
 	shell_sidebar = E_SHELL_SIDEBAR (task_shell_sidebar);
@@ -431,6 +445,8 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
 		return;
 	}
 
+	/* it's only for pointer comparison, no need to ref it */
+	priv->loading_default_source_instance = source;
 	priv->loading_default_client = g_cancellable_new ();
 
 	e_client_utils_open_new (



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