[Evolution] Bug#582029: libecal1.2-7: include fix for e_source_get_uri() warning "called on source with no absolute URI!"

Tino Keitel tino.keitel+debbugs at tikei.de
Mon May 17 19:01:08 UTC 2010


Package: libecal1.2-7
Version: 2.30.1-1
Severity: normal
Tags: patch

Hi,

commit bf47a23ee4994597ca0a8757edd5ff0798435517 fixes a bug which causes a
warning, and in my case caused a segmentation fault in e_cal_open_default(). 
I suggest to include it in the Debian package until it is included in a new
upstream bugfix release.

Regards,
Tino

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.34-00001-g7adb552 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libecal1.2-7 depends on:
ii  libc6                       2.10.2-8     Embedded GNU C Library: Shared lib
ii  libdbus-1-3                 1.2.24-1     simple interprocess messaging syst
ii  libdbus-glib-1-2            0.86-1       simple interprocess messaging syst
ii  libedataserver1.2-11        2.30.1-2     Utility library for evolution data
ii  libgconf2-4                 2.28.1-3     GNOME configuration database syste
ii  libglib2.0-0                2.24.1-1     The GLib library of C routines
ii  libical0                    0.44-3       iCalendar library implementation i
ii  libnspr4-0d                 4.8.4-1      NetScape Portable Runtime Library
ii  libsoup2.4-1                2.30.1-1     an HTTP library implementation in 
ii  libxml2                     2.7.7.dfsg-2 GNOME XML library

libecal1.2-7 recommends no packages.

libecal1.2-7 suggests no packages.

-- no debconf information
-------------- next part --------------
>From 2174fdbba0dcf4854c55fbbfbfa6e582d2a6fccf Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha at redhat.com>
Date: Thu, 06 May 2010 17:43:59 +0000
Subject: e_cal_new_from_uri/e_cal_open_default emits runtime warning

The warning is "e_source_get_uri () called on source with no absolute URI!"
and it's caused by freeing the ESourceList before ECal creation.
This change is fixing the issue.
---
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index c8299d5..d28b2b8 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -878,23 +878,28 @@ e_cal_new (ESource *source, ECalSourceType type)
 
 /* for each known source calls check_func, which should return TRUE if the required
    source have been found. Function returns NULL or the source on which was returned
-   TRUE by the check_func. Non-NULL pointer should be unreffed by g_object_unref. */
+   TRUE by the check_func. Non-NULL pointer should be unreffed by g_object_unref.
+
+   'sources' is an output parameter and cannot be NULL. When returned non-NULL, then
+   should be freed with g_object_unref function. */
 static ESource *
-search_known_sources (ECalSourceType type, gboolean (*check_func)(ESource *source, gpointer user_data), gpointer user_data, GError **error)
+search_known_sources (ECalSourceType type, gboolean (*check_func)(ESource *source, gpointer user_data), gpointer user_data, ESourceList **sources, GError **error)
 {
-	ESourceList *sources;
 	ESource *res = NULL;
 	GSList *g;
 	GError *err = NULL;
 
+	g_return_val_if_fail (sources != NULL, NULL);
 	g_return_val_if_fail (check_func != NULL, NULL);
 
-	if (!e_cal_get_sources (&sources, type, &err)) {
+	*sources = NULL;
+
+	if (!e_cal_get_sources (sources, type, &err)) {
 		g_propagate_error (error, err);
 		return NULL;
 	}
 
-	for (g = e_source_list_peek_groups (sources); g; g = g->next) {
+	for (g = e_source_list_peek_groups (*sources); g; g = g->next) {
 		ESourceGroup *group = E_SOURCE_GROUP (g->data);
 		GSList *s;
 
@@ -911,8 +916,6 @@ search_known_sources (ECalSourceType type, gboolean (*check_func)(ESource *sourc
 			break;
 	}
 
-	g_object_unref (sources);
-
 	return res;
 }
 
@@ -943,16 +946,19 @@ check_uri (ESource *source, gpointer uri)
 ECal *
 e_cal_new_from_uri (const gchar *uri, ECalSourceType type)
 {
+	ESourceList *sources = NULL;
 	ESource *source;
 	ECal *cal;
 
-	source = search_known_sources (type, check_uri, (gpointer) uri, NULL);
+	source = search_known_sources (type, check_uri, (gpointer) uri, &sources, NULL);
 	if (!source)
 		source = e_source_new_with_absolute_uri ("", uri);
 
 	cal = e_cal_new (source, type);
 
 	g_object_unref (source);
+	if (sources)
+		g_object_unref (sources);
 
 	return cal;
 }
@@ -4056,6 +4062,7 @@ check_default (ESource *source, gpointer data)
 gboolean
 e_cal_open_default (ECal **ecal, ECalSourceType type, ECalAuthFunc func, gpointer data, GError **error)
 {
+	ESourceList *sources = NULL;
 	GError *err = NULL;
 	ESource *default_source;
 	gboolean res = TRUE;
@@ -4063,9 +4070,11 @@ e_cal_open_default (ECal **ecal, ECalSourceType type, ECalAuthFunc func, gpointe
 	e_return_error_if_fail (ecal != NULL, E_CALENDAR_STATUS_INVALID_ARG);
 	*ecal = NULL;
 
-	default_source = search_known_sources (type, check_default, NULL, &err);
+	default_source = search_known_sources (type, check_default, NULL, &sources, &err);
 
 	if (err) {
+		if (sources)
+			g_object_unref (sources);
 		g_propagate_error (error, err);
 		return FALSE;
 	}
@@ -4104,6 +4113,9 @@ e_cal_open_default (ECal **ecal, ECalSourceType type, ECalAuthFunc func, gpointe
 		*ecal = NULL;
 	}
 
+	if (sources)
+		g_object_unref (sources);
+
 	return res;
 }
 
--
cgit v0.8.3.1


More information about the Pkg-evolution-maintainers mailing list