Merge lp:~indicator-applet-developers/ubuntu/precise/indicator-datetime/upstream into lp:~ubuntu-desktop/indicator-datetime/ubuntu

Proposed by Charles Kerr
Status: Merged
Merged at revision: 139
Proposed branch: lp:~indicator-applet-developers/ubuntu/precise/indicator-datetime/upstream
Merge into: lp:~ubuntu-desktop/indicator-datetime/ubuntu
Diff against target: 533 lines (+155/-91)
6 files modified
ChangeLog (+52/-0)
configure (+17/-15)
configure.ac (+1/-1)
debian/changelog (+7/-0)
m4/intltool.m4 (+8/-6)
src/datetime-service.c (+70/-69)
To merge this branch: bzr merge lp:~indicator-applet-developers/ubuntu/precise/indicator-datetime/upstream
Reviewer Review Type Date Requested Status
Ken VanDine Pending
Review via email: mp+98680@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-03-08 22:57:20 +0000
3+++ ChangeLog 2012-03-21 16:52:25 +0000
4@@ -1,5 +1,57 @@
5 # Generated by Makefile. Do not edit.
6
7+2012-03-21 Charles Kerr <charles.kerr@canonical.com>
8+
9+ 0.3.92
10+
11+2012-03-20 Charles Kerr <charles.kerr@canonical.com>
12+
13+ merge lp:~charlesk/indicator-datetime/lp-772340 to fix some memory leaks related to appointments in indicator-datetime
14+
15+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
16+
17+ leak: fix ESourceList leak in update_appointment_menu_items()
18+
19+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
20+
21+ leak: fix GdkPixbuf leak when setting up appointments
22+
23+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
24+
25+ minor: fix inefficient GSList walking -- only walk a GSList once instead of twice per node
26+
27+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
28+
29+ leak: fix the comp_instance struct leaks allocated in populate_appointment_instances() from update_appointment_menu_items(). The list was freed, but not the structs pointed to by the list.
30+
31+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
32+
33+ don't subtract one time_t from another
34+
35+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
36+
37+ leak: plug leaks related to use of gconf_client_get_list()
38+
39+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
40+
41+ minor: use g_clear_error() instead of g_error_free()
42+
43+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
44+
45+ leak: fix GError leaks
46+
47+2012-03-16 Charles Kerr <charles.kerr@canonical.com>
48+
49+ plug a string leak when updating the appointments
50+
51+2012-03-16 Charles Kerr <charles.kerr@canonical.com>
52+
53+ minor: remove unnecessary nesting
54+
55+2012-03-16 Charles Kerr <charles.kerr@canonical.com>
56+
57+ plug a string leak when updating appointments
58+
59 2012-03-08 Ted Gould <ted@gould.cx>
60
61 0.3.91
62
63=== modified file 'configure'
64--- configure 2012-03-08 22:57:20 +0000
65+++ configure 2012-03-21 16:52:25 +0000
66@@ -1,6 +1,6 @@
67 #! /bin/sh
68 # Guess values for system-dependent variables and create Makefiles.
69-# Generated by GNU Autoconf 2.68 for indicator-datetime 0.3.91.
70+# Generated by GNU Autoconf 2.68 for indicator-datetime 0.3.92.
71 #
72 # Report bugs to <http://bugs.launchpad.net/indicator-datetime>.
73 #
74@@ -572,8 +572,8 @@
75 # Identity of this package.
76 PACKAGE_NAME='indicator-datetime'
77 PACKAGE_TARNAME='indicator-datetime'
78-PACKAGE_VERSION='0.3.91'
79-PACKAGE_STRING='indicator-datetime 0.3.91'
80+PACKAGE_VERSION='0.3.92'
81+PACKAGE_STRING='indicator-datetime 0.3.92'
82 PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-datetime'
83 PACKAGE_URL='http://launchpad.net/indicator-datetime'
84
85@@ -1395,7 +1395,7 @@
86 # Omit some internal or obsolete options to make the list less imposing.
87 # This message is too long to be a string in the A/UX 3.1 sh.
88 cat <<_ACEOF
89-\`configure' configures indicator-datetime 0.3.91 to adapt to many kinds of systems.
90+\`configure' configures indicator-datetime 0.3.92 to adapt to many kinds of systems.
91
92 Usage: $0 [OPTION]... [VAR=VALUE]...
93
94@@ -1466,7 +1466,7 @@
95
96 if test -n "$ac_init_help"; then
97 case $ac_init_help in
98- short | recursive ) echo "Configuration of indicator-datetime 0.3.91:";;
99+ short | recursive ) echo "Configuration of indicator-datetime 0.3.92:";;
100 esac
101 cat <<\_ACEOF
102
103@@ -1600,7 +1600,7 @@
104 test -n "$ac_init_help" && exit $ac_status
105 if $ac_init_version; then
106 cat <<\_ACEOF
107-indicator-datetime configure 0.3.91
108+indicator-datetime configure 0.3.92
109 generated by GNU Autoconf 2.68
110
111 Copyright (C) 2010 Free Software Foundation, Inc.
112@@ -1971,7 +1971,7 @@
113 This file contains any messages produced by compilers while
114 running configure, to aid debugging if configure makes a mistake.
115
116-It was created by indicator-datetime $as_me 0.3.91, which was
117+It was created by indicator-datetime $as_me 0.3.92, which was
118 generated by GNU Autoconf 2.68. Invocation command line was
119
120 $ $0 $@
121@@ -2795,7 +2795,7 @@
122
123 # Define the identity of the package.
124 PACKAGE='indicator-datetime'
125- VERSION='0.3.91'
126+ VERSION='0.3.92'
127
128
129 cat >>confdefs.h <<_ACEOF
130@@ -13205,14 +13205,12 @@
131 ;;
132 esac
133
134+INTLTOOL_REQUIRED_VERSION_AS_INT=`echo 0.41.0 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
135+INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
136+INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
137 if test -n "0.41.0"; then
138 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intltool >= 0.41.0" >&5
139 $as_echo_n "checking for intltool >= 0.41.0... " >&6; }
140-
141- INTLTOOL_REQUIRED_VERSION_AS_INT=`echo 0.41.0 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
142- INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
143- INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
144-
145 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_APPLIED_VERSION found" >&5
146 $as_echo "$INTLTOOL_APPLIED_VERSION found" >&6; }
147 test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
148@@ -13373,7 +13371,11 @@
149 INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
150 INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
151 INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
152+if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then
153 INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< $@'
154+else
155+ INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.$$RANDOM && mkdir $$_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u $$_it_tmp_dir $< $@ && rmdir $$_it_tmp_dir'
156+fi
157 INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
158 INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
159 INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
160@@ -15041,7 +15043,7 @@
161 # report actual input values of CONFIG_FILES etc. instead of their
162 # values after options handling.
163 ac_log="
164-This file was extended by indicator-datetime $as_me 0.3.91, which was
165+This file was extended by indicator-datetime $as_me 0.3.92, which was
166 generated by GNU Autoconf 2.68. Invocation command line was
167
168 CONFIG_FILES = $CONFIG_FILES
169@@ -15108,7 +15110,7 @@
170 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
171 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
172 ac_cs_version="\\
173-indicator-datetime config.status 0.3.91
174+indicator-datetime config.status 0.3.92
175 configured by $0, generated by GNU Autoconf 2.68,
176 with options \\"\$ac_cs_config\\"
177
178
179=== modified file 'configure.ac'
180--- configure.ac 2012-03-08 22:57:20 +0000
181+++ configure.ac 2012-03-21 16:52:25 +0000
182@@ -1,5 +1,5 @@
183 AC_INIT([indicator-datetime],
184- [0.3.91],
185+ [0.3.92],
186 [http://bugs.launchpad.net/indicator-datetime],
187 [indicator-datetime],
188 [http://launchpad.net/indicator-datetime])
189
190=== modified file 'debian/changelog'
191--- debian/changelog 2012-03-09 12:49:52 +0000
192+++ debian/changelog 2012-03-21 16:52:25 +0000
193@@ -1,3 +1,10 @@
194+indicator-datetime (0.3.92-0ubuntu1~ppa1) precise; urgency=low
195+
196+ * New upstream release.
197+ * Fix several memory leaks (LP: #772340, LP: #957320)
198+
199+ -- Charles Kerr <charles.kerr@canonical.com> Wed, 21 Mar 2012 11:22:20 -0500
200+
201 indicator-datetime (0.3.91-0ubuntu1) precise; urgency=low
202
203 * New upstream release.
204
205=== modified file 'm4/intltool.m4'
206--- m4/intltool.m4 2012-02-17 22:15:25 +0000
207+++ m4/intltool.m4 2012-03-21 16:52:25 +0000
208@@ -23,7 +23,7 @@
209 ## the same distribution terms that you use for the rest of that program.
210
211 dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml])
212-# serial 41 IT_PROG_INTLTOOL
213+# serial 42 IT_PROG_INTLTOOL
214 AC_DEFUN([IT_PROG_INTLTOOL], [
215 AC_PREREQ([2.50])dnl
216 AC_REQUIRE([AM_NLS])dnl
217@@ -36,13 +36,11 @@
218 ;;
219 esac
220
221+INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
222+INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
223+INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
224 if test -n "$1"; then
225 AC_MSG_CHECKING([for intltool >= $1])
226-
227- INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
228- INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
229- [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
230- ]
231 AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found])
232 test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
233 AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.])
234@@ -85,7 +83,11 @@
235 INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
236 INTLTOOL_UI_RULE='%.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
237 INTLTOOL_XML_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
238+if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then
239 INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< [$]@'
240+else
241+ INTLTOOL_XML_NOMERGE_RULE='%.xml: %.xml.in $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.[$][$]RANDOM && mkdir [$][$]_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u [$][$]_it_tmp_dir $< [$]@ && rmdir [$][$]_it_tmp_dir'
242+fi
243 INTLTOOL_XAM_RULE='%.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
244 INTLTOOL_KBD_RULE='%.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
245 INTLTOOL_CAVES_RULE='%.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< [$]@'
246
247=== modified file 'src/datetime-service.c'
248--- src/datetime-service.c 2012-03-08 22:57:20 +0000
249+++ src/datetime-service.c 2012-03-21 16:52:25 +0000
250@@ -273,7 +273,7 @@
251
252 if (error != NULL) {
253 g_warning("Could not set timezone for SettingsDaemon: %s", error->message);
254- g_error_free(error);
255+ g_clear_error (&error);
256 return;
257 }
258
259@@ -289,7 +289,7 @@
260
261 if (error != NULL) {
262 g_warning("Could not grab DBus proxy for SettingsDaemon: %s", error->message);
263- g_error_free(error);
264+ g_clear_error (&error);
265 g_free (zone);
266 return;
267 }
268@@ -363,7 +363,7 @@
269 g_debug("Issuing command '%s'", command);
270 if (!g_spawn_command_line_async(command, &error)) {
271 g_warning("Unable to start %s: %s", (char *)command, error->message);
272- g_error_free(error);
273+ g_clear_error (&error);
274 }
275 }
276
277@@ -532,7 +532,7 @@
278 GSList *accounts_list = gconf_client_get_list (gconf, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL);
279 const guint n = g_slist_length (accounts_list);
280 g_debug ("found %u evolution accounts", n);
281- g_slist_free (accounts_list);
282+ g_slist_free_full (accounts_list, g_free);
283 return n > 0;
284 }
285
286@@ -613,22 +613,43 @@
287 }
288
289 static gint
290-compare_comp_instances (gconstpointer a,
291- gconstpointer b)
292-{
293- const struct comp_instance *ci_a = a;
294- const struct comp_instance *ci_b = b;
295- time_t d = ci_a->start - ci_b->start;
296- if (d < 0) return -1;
297- else if (d > 0) return 1;
298- return 0;
299+compare_comp_instances (gconstpointer ga, gconstpointer gb)
300+{
301+ const struct comp_instance * a = ga;
302+ const struct comp_instance * b = gb;
303+
304+ /* sort by start time */
305+ if (a->start < b->start) return -1;
306+ if (a->start > b->start) return 1;
307+ return 0;
308+}
309+
310+static struct comp_instance*
311+comp_instance_new (ECalComponent * comp, time_t start, time_t end, ESource * source)
312+{
313+ g_debug("Using times start %s, end %s", ctime(&start), ctime(&end));
314+
315+ struct comp_instance *ci = g_new (struct comp_instance, 1);
316+ ci->comp = g_object_ref (comp);
317+ ci->source = source;
318+ ci->start = start;
319+ ci->end = end;
320+ return ci;
321+}
322+static void
323+comp_instance_free (struct comp_instance* ci)
324+{
325+ if (ci != NULL) {
326+ g_clear_object (&ci->comp);
327+ g_free (ci);
328+ }
329 }
330
331 static gboolean
332-populate_appointment_instances (ECalComponent *comp,
333- time_t instance_start,
334- time_t instance_end,
335- gpointer data)
336+populate_appointment_instances (ECalComponent * comp,
337+ time_t start,
338+ time_t end,
339+ gpointer data)
340 {
341 g_debug("Appending item %p", comp);
342
343@@ -638,20 +659,9 @@
344 icalproperty_status status;
345 e_cal_component_get_status (comp, &status);
346 if (status == ICAL_STATUS_COMPLETED || status == ICAL_STATUS_CANCELLED) return FALSE;
347-
348- g_object_ref(comp);
349
350- struct comp_instance *ci;
351- ci = g_new (struct comp_instance, 1);
352-
353- g_debug("Using times start %s, end %s", ctime(&instance_start), ctime(&instance_end));
354-
355- ci->comp = comp;
356- ci->source = E_SOURCE(data);
357- ci->start = instance_start;
358- ci->end = instance_end;
359-
360- comp_instances = g_list_append(comp_instances, ci);
361+ struct comp_instance *ci = comp_instance_new (comp, start, end, E_SOURCE(data));
362+ comp_instances = g_list_append (comp_instances, ci);
363 return TRUE;
364 }
365
366@@ -719,25 +729,18 @@
367
368 if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) {
369 g_debug("Failed to get ecal sources\n");
370+ g_clear_error (&gerror);
371 return FALSE;
372 }
373
374- // Free comp_instances if not NULL
375- if (comp_instances != NULL) {
376- g_debug("Freeing comp_instances: may be an overlap\n");
377- for (l = comp_instances; l; l = l->next) {
378- const struct comp_instance *ci = l->data;
379- g_object_unref(ci->comp);
380- }
381- g_list_free(comp_instances);
382- comp_instances = NULL;
383+ // clear any previous comp_instances
384+ g_list_free_full (comp_instances, (GDestroyNotify)comp_instance_free);
385+ comp_instances = NULL;
386
387- }
388 GSList *cal_list = gconf_client_get_list(gconf, "/apps/evolution/calendar/display/selected_calendars", GCONF_VALUE_STRING, &gerror);
389 if (gerror) {
390 g_debug("Failed to get evolution preference for enabled calendars");
391- g_error_free(gerror);
392- gerror = NULL;
393+ g_clear_error (&gerror);
394 cal_list = NULL;
395 }
396
397@@ -759,39 +762,33 @@
398 }
399 if (current_zone && !e_cal_set_default_timezone(ecal, current_zone, &gerror)) {
400 g_debug("Failed to set ecal default timezone %s", gerror->message);
401- g_error_free(gerror);
402- gerror = NULL;
403+ g_clear_error (&gerror);
404 g_object_unref(ecal);
405 continue;
406 }
407
408 if (!e_cal_open(ecal, FALSE, &gerror)) {
409 g_debug("Failed to get ecal sources %s", gerror->message);
410- g_error_free(gerror);
411- gerror = NULL;
412+ g_clear_error (&gerror);
413 g_object_unref(ecal);
414 continue;
415 }
416+
417 const gchar *ecal_uid = e_source_peek_uid(source);
418- gboolean match = FALSE;
419 g_debug("Checking ecal_uid is enabled: %s", ecal_uid);
420- for (i = 0; i<g_slist_length(cal_list);i++) {
421- char *cuid = (char *)g_slist_nth_data(cal_list, i);
422- if (g_strcmp0(cuid, ecal_uid) == 0) {
423- match = TRUE;
424- break;
425- }
426- }
427- if (!match) {
428+ const gboolean in_list = g_slist_find_custom (cal_list, ecal_uid, (GCompareFunc)g_strcmp0) != NULL;
429+ if (!in_list) {
430 g_object_unref(ecal);
431 continue;
432 }
433+
434 g_debug("ecal_uid is enabled, generating instances");
435-
436- e_cal_generate_instances (ecal, t1, t2, (ECalRecurInstanceFn) populate_appointment_instances, (gpointer) source);
437+ e_cal_generate_instances (ecal, t1, t2, (ECalRecurInstanceFn) populate_appointment_instances, source);
438 g_object_unref(ecal);
439 }
440 }
441+ g_slist_free_full (cal_list, g_free);
442+
443 g_debug("Number of ECalComponents returned: %d", g_list_length(comp_instances));
444 GList *sorted_comp_instances = g_list_sort(comp_instances, compare_comp_instances);
445 comp_instances = NULL;
446@@ -821,13 +818,12 @@
447 apt_output = SETTINGS_TIME_12_HOUR;
448 } else if (g_strcmp0(time_format_str, "24-hour") == 0) {
449 apt_output = SETTINGS_TIME_24_HOUR;
450+ } else if (is_locale_12h()) {
451+ apt_output = SETTINGS_TIME_12_HOUR;
452 } else {
453- if (is_locale_12h()) {
454- apt_output = SETTINGS_TIME_12_HOUR;
455- } else {
456- apt_output = SETTINGS_TIME_24_HOUR;
457- }
458+ apt_output = SETTINGS_TIME_24_HOUR;
459 }
460+ g_free (time_format_str);
461
462 GVariantBuilder markeddays;
463 g_variant_builder_init (&markeddays, G_VARIANT_TYPE ("ai"));
464@@ -1001,6 +997,7 @@
465 }
466
467 dbusmenu_menuitem_property_set_image (item, APPOINTMENT_MENUITEM_PROP_ICON, pixbuf);
468+ g_clear_object (&pixbuf);
469 } else {
470 g_debug("Creating pixbuf from surface failed");
471 }
472@@ -1010,15 +1007,15 @@
473 g_debug("Adding appointment: %p", item);
474 }
475
476- if (gerror != NULL) g_error_free(gerror);
477- for (l = sorted_comp_instances; l; l = l->next) {
478- const struct comp_instance *ci = l->data;
479- g_object_unref(ci->comp);
480- }
481- g_list_free(sorted_comp_instances);
482+ g_clear_error (&gerror);
483+
484+ g_list_free_full (sorted_comp_instances, (GDestroyNotify)comp_instance_free);
485+ sorted_comp_instances = NULL;
486
487 GVariant * marks = g_variant_builder_end (&markeddays);
488 dbusmenu_menuitem_property_set_variant (calendar, CALENDAR_MENUITEM_PROP_MARKS, marks);
489+
490+ g_clear_object (&sources);
491
492 updating_appointments = FALSE;
493 g_debug("End of objects");
494@@ -1205,7 +1202,7 @@
495
496 if (error != NULL) {
497 g_warning("Could not grab DBus proxy for ConsoleKit: %s", error->message);
498- g_error_free(error);
499+ g_clear_error (&error);
500 return;
501 }
502
503@@ -1218,6 +1215,7 @@
504 {
505 if (error != NULL) {
506 g_warning("Unable to get Geoclue address: %s", error->message);
507+ g_clear_error (&error);
508 return;
509 }
510
511@@ -1279,6 +1277,7 @@
512 {
513 if (error != NULL) {
514 g_warning("Unable to create GeoClue address: %s", error->message);
515+ g_clear_error (&error);
516 return;
517 }
518
519@@ -1305,6 +1304,7 @@
520 {
521 if (error != NULL) {
522 g_warning("Unable to set Geoclue requirements: %s", error->message);
523+ g_clear_error (&error);
524 }
525 return;
526 }
527@@ -1367,6 +1367,7 @@
528
529 if (error != NULL) {
530 g_warning("Unable to get a GeoClue client! '%s' Geolocation based timezone support will not be available.", error->message);
531+ g_clear_error (&error);
532 return;
533 }
534

Subscribers

People subscribed via source and target branches