~ubuntu-branches/ubuntu/natty/evolution-data-server/natty

« back to all changes in this revision

Viewing changes to debian/patches/02_fix-warning-in_source_get_uri.patch

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-21 20:28:22 UTC
  • mfrom: (1.2.13 sid)
  • Revision ID: james.westby@ubuntu.com-20100521202822-kcit2z9s5gi76oy1
Tags: 2.30.1-4ubuntu1
* Merge from debian unstable. Remaining changes:
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
commit bf47a23ee4994597ca0a8757edd5ff0798435517
 
2
Author: Milan Crha <mcrha@redhat.com>
 
3
Date:   Thu May 6 19:44:34 2010 +0200
 
4
 
 
5
    e_cal_new_from_uri/e_cal_open_default emits runtime warning
 
6
    
 
7
    The warning is "e_source_get_uri () called on source with no absolute URI!"
 
8
    and it's caused by freeing the ESourceList before ECal creation.
 
9
    This change is fixing the issue.
 
10
 
 
11
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
 
12
index d1dfdac..7de9052 100644
 
13
--- a/calendar/libecal/e-cal.c
 
14
+++ b/calendar/libecal/e-cal.c
 
15
@@ -879,23 +879,28 @@ e_cal_new (ESource *source, ECalSourceType type)
 
16
 
 
17
 /* for each known source calls check_func, which should return TRUE if the required
 
18
    source have been found. Function returns NULL or the source on which was returned
 
19
-   TRUE by the check_func. Non-NULL pointer should be unreffed by g_object_unref. */
 
20
+   TRUE by the check_func. Non-NULL pointer should be unreffed by g_object_unref.
 
21
+
 
22
+   'sources' is an output parameter and cannot be NULL. When returned non-NULL, then
 
23
+   should be freed with g_object_unref function. */
 
24
 static ESource *
 
25
-search_known_sources (ECalSourceType type, gboolean (*check_func)(ESource *source, gpointer user_data), gpointer user_data, GError **error)
 
26
+search_known_sources (ECalSourceType type, gboolean (*check_func)(ESource *source, gpointer user_data), gpointer user_data, ESourceList **sources, GError **error)
 
27
 {
 
28
-       ESourceList *sources;
 
29
        ESource *res = NULL;
 
30
        GSList *g;
 
31
        GError *err = NULL;
 
32
 
 
33
+       g_return_val_if_fail (sources != NULL, NULL);
 
34
        g_return_val_if_fail (check_func != NULL, NULL);
 
35
 
 
36
-       if (!e_cal_get_sources (&sources, type, &err)) {
 
37
+       *sources = NULL;
 
38
+
 
39
+       if (!e_cal_get_sources (sources, type, &err)) {
 
40
                g_propagate_error (error, err);
 
41
                return NULL;
 
42
        }
 
43
 
 
44
-       for (g = e_source_list_peek_groups (sources); g; g = g->next) {
 
45
+       for (g = e_source_list_peek_groups (*sources); g; g = g->next) {
 
46
                ESourceGroup *group = E_SOURCE_GROUP (g->data);
 
47
                GSList *s;
 
48
 
 
49
@@ -912,8 +917,6 @@ search_known_sources (ECalSourceType type, gboolean (*check_func)(ESource *sourc
 
50
                        break;
 
51
        }
 
52
 
 
53
-       g_object_unref (sources);
 
54
-
 
55
        return res;
 
56
 }
 
57
 
 
58
@@ -944,16 +947,19 @@ check_uri (ESource *source, gpointer uri)
 
59
 ECal *
 
60
 e_cal_new_from_uri (const gchar *uri, ECalSourceType type)
 
61
 {
 
62
+       ESourceList *sources = NULL;
 
63
        ESource *source;
 
64
        ECal *cal;
 
65
 
 
66
-       source = search_known_sources (type, check_uri, (gpointer) uri, NULL);
 
67
+       source = search_known_sources (type, check_uri, (gpointer) uri, &sources, NULL);
 
68
        if (!source)
 
69
                source = e_source_new_with_absolute_uri ("", uri);
 
70
 
 
71
        cal = e_cal_new (source, type);
 
72
 
 
73
        g_object_unref (source);
 
74
+       if (sources)
 
75
+               g_object_unref (sources);
 
76
 
 
77
        return cal;
 
78
 }
 
79
@@ -4057,6 +4063,7 @@ check_default (ESource *source, gpointer data)
 
80
 gboolean
 
81
 e_cal_open_default (ECal **ecal, ECalSourceType type, ECalAuthFunc func, gpointer data, GError **error)
 
82
 {
 
83
+       ESourceList *sources = NULL;
 
84
        GError *err = NULL;
 
85
        ESource *default_source;
 
86
        gboolean res = TRUE;
 
87
@@ -4064,9 +4071,11 @@ e_cal_open_default (ECal **ecal, ECalSourceType type, ECalAuthFunc func, gpointe
 
88
        e_return_error_if_fail (ecal != NULL, E_CALENDAR_STATUS_INVALID_ARG);
 
89
        *ecal = NULL;
 
90
 
 
91
-       default_source = search_known_sources (type, check_default, NULL, &err);
 
92
+       default_source = search_known_sources (type, check_default, NULL, &sources, &err);
 
93
 
 
94
        if (err) {
 
95
+               if (sources)
 
96
+                       g_object_unref (sources);
 
97
                g_propagate_error (error, err);
 
98
                return FALSE;
 
99
        }
 
100
@@ -4105,6 +4114,9 @@ e_cal_open_default (ECal **ecal, ECalSourceType type, ECalAuthFunc func, gpointe
 
101
                *ecal = NULL;
 
102
        }
 
103
 
 
104
+       if (sources)
 
105
+               g_object_unref (sources);
 
106
+
 
107
        return res;
 
108
 }
 
109