aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-03-21 11:19:31 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-03-21 11:19:31 -0500
commitebb2aa102eb05194f34b14f78bac3217cba79d6a (patch)
tree0acd4bf00706fa2ef3eb79db976372f8bf96378b
parent827c79ed60fe16f4281289eb09e468af4fe5f8e4 (diff)
parent7eb6ba328fafe16a46be831351e3aa04a1465cb3 (diff)
downloadayatana-indicator-datetime-ebb2aa102eb05194f34b14f78bac3217cba79d6a.tar.gz
ayatana-indicator-datetime-ebb2aa102eb05194f34b14f78bac3217cba79d6a.tar.bz2
ayatana-indicator-datetime-ebb2aa102eb05194f34b14f78bac3217cba79d6a.zip
* New upstream release.
* Fix several memory leaks (LP: #772340, LP: #957320)
-rw-r--r--ChangeLog52
-rwxr-xr-xconfigure32
-rw-r--r--configure.ac2
-rw-r--r--debian/changelog7
-rw-r--r--m4/intltool.m414
-rw-r--r--src/datetime-service.c137
6 files changed, 154 insertions, 90 deletions
diff --git a/ChangeLog b/ChangeLog
index d5ab872..09fa847 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,57 @@
# Generated by Makefile. Do not edit.
+2012-03-21 Charles Kerr <charles.kerr@canonical.com>
+
+ 0.3.92
+
+2012-03-20 Charles Kerr <charles.kerr@canonical.com>
+
+ merge lp:~charlesk/indicator-datetime/lp-772340 to fix some memory leaks related to appointments in indicator-datetime
+
+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
+
+ leak: fix ESourceList leak in update_appointment_menu_items()
+
+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
+
+ leak: fix GdkPixbuf leak when setting up appointments
+
+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
+
+ minor: fix inefficient GSList walking -- only walk a GSList once instead of twice per node
+
+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
+
+ 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.
+
+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
+
+ don't subtract one time_t from another
+
+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
+
+ leak: plug leaks related to use of gconf_client_get_list()
+
+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
+
+ minor: use g_clear_error() instead of g_error_free()
+
+2012-03-18 Charles Kerr <charles.kerr@canonical.com>
+
+ leak: fix GError leaks
+
+2012-03-16 Charles Kerr <charles.kerr@canonical.com>
+
+ plug a string leak when updating the appointments
+
+2012-03-16 Charles Kerr <charles.kerr@canonical.com>
+
+ minor: remove unnecessary nesting
+
+2012-03-16 Charles Kerr <charles.kerr@canonical.com>
+
+ plug a string leak when updating appointments
+
2012-03-08 Ted Gould <ted@gould.cx>
0.3.91
diff --git a/configure b/configure
index 714572e..7619854 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68 for indicator-datetime 0.3.91.
+# Generated by GNU Autoconf 2.68 for indicator-datetime 0.3.92.
#
# Report bugs to <http://bugs.launchpad.net/indicator-datetime>.
#
@@ -572,8 +572,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='indicator-datetime'
PACKAGE_TARNAME='indicator-datetime'
-PACKAGE_VERSION='0.3.91'
-PACKAGE_STRING='indicator-datetime 0.3.91'
+PACKAGE_VERSION='0.3.92'
+PACKAGE_STRING='indicator-datetime 0.3.92'
PACKAGE_BUGREPORT='http://bugs.launchpad.net/indicator-datetime'
PACKAGE_URL='http://launchpad.net/indicator-datetime'
@@ -1395,7 +1395,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures indicator-datetime 0.3.91 to adapt to many kinds of systems.
+\`configure' configures indicator-datetime 0.3.92 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1466,7 +1466,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of indicator-datetime 0.3.91:";;
+ short | recursive ) echo "Configuration of indicator-datetime 0.3.92:";;
esac
cat <<\_ACEOF
@@ -1600,7 +1600,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-indicator-datetime configure 0.3.91
+indicator-datetime configure 0.3.92
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -1971,7 +1971,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by indicator-datetime $as_me 0.3.91, which was
+It was created by indicator-datetime $as_me 0.3.92, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2795,7 +2795,7 @@ fi
# Define the identity of the package.
PACKAGE='indicator-datetime'
- VERSION='0.3.91'
+ VERSION='0.3.92'
cat >>confdefs.h <<_ACEOF
@@ -13205,14 +13205,12 @@ case "$am__api_version" in
;;
esac
+INTLTOOL_REQUIRED_VERSION_AS_INT=`echo 0.41.0 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
+INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
+INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
if test -n "0.41.0"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for intltool >= 0.41.0" >&5
$as_echo_n "checking for intltool >= 0.41.0... " >&6; }
-
- INTLTOOL_REQUIRED_VERSION_AS_INT=`echo 0.41.0 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
- INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
- INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_APPLIED_VERSION found" >&5
$as_echo "$INTLTOOL_APPLIED_VERSION found" >&6; }
test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
@@ -13373,7 +13371,11 @@ INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcar
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 $< $@'
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 $< $@'
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 $< $@'
+if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then
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 $< $@'
+else
+ 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'
+fi
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 $< $@'
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 $< $@'
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 $< $@'
@@ -15041,7 +15043,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by indicator-datetime $as_me 0.3.91, which was
+This file was extended by indicator-datetime $as_me 0.3.92, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -15108,7 +15110,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-indicator-datetime config.status 0.3.91
+indicator-datetime config.status 0.3.92
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index f033f41..6377b9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_INIT([indicator-datetime],
- [0.3.91],
+ [0.3.92],
[http://bugs.launchpad.net/indicator-datetime],
[indicator-datetime],
[http://launchpad.net/indicator-datetime])
diff --git a/debian/changelog b/debian/changelog
index 7a1de4c..619b9eb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+indicator-datetime (0.3.92-0ubuntu1~ppa1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ * Fix several memory leaks (LP: #772340, LP: #957320)
+
+ -- Charles Kerr <charles.kerr@canonical.com> Wed, 21 Mar 2012 11:17:15 -0500
+
indicator-datetime (0.3.91-0ubuntu1) precise; urgency=low
* New upstream release.
diff --git a/m4/intltool.m4 b/m4/intltool.m4
index 0c04c06..33353ed 100644
--- a/m4/intltool.m4
+++ b/m4/intltool.m4
@@ -23,7 +23,7 @@
## the same distribution terms that you use for the rest of that program.
dnl IT_PROG_INTLTOOL([MINIMUM-VERSION], [no-xml])
-# serial 41 IT_PROG_INTLTOOL
+# serial 42 IT_PROG_INTLTOOL
AC_DEFUN([IT_PROG_INTLTOOL], [
AC_PREREQ([2.50])dnl
AC_REQUIRE([AM_NLS])dnl
@@ -36,13 +36,11 @@ case "$am__api_version" in
;;
esac
+INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
+INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
+INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
if test -n "$1"; then
AC_MSG_CHECKING([for intltool >= $1])
-
- INTLTOOL_REQUIRED_VERSION_AS_INT=`echo $1 | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
- INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
- [INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
- ]
AC_MSG_RESULT([$INTLTOOL_APPLIED_VERSION found])
test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
AC_MSG_ERROR([Your intltool is too old. You need intltool $1 or later.])
@@ -85,7 +83,11 @@ INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcar
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 $< [$]@'
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 $< [$]@'
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 $< [$]@'
+if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then
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 $< [$]@'
+else
+ 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'
+fi
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 $< [$]@'
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 $< [$]@'
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 $< [$]@'
diff --git a/src/datetime-service.c b/src/datetime-service.c
index a782d80..a10cbb5 100644
--- a/src/datetime-service.c
+++ b/src/datetime-service.c
@@ -273,7 +273,7 @@ quick_set_tz_cb (GObject *object, GAsyncResult *res, gpointer data)
if (error != NULL) {
g_warning("Could not set timezone for SettingsDaemon: %s", error->message);
- g_error_free(error);
+ g_clear_error (&error);
return;
}
@@ -289,7 +289,7 @@ quick_set_tz_proxy_cb (GObject *object, GAsyncResult *res, gpointer zone)
if (error != NULL) {
g_warning("Could not grab DBus proxy for SettingsDaemon: %s", error->message);
- g_error_free(error);
+ g_clear_error (&error);
g_free (zone);
return;
}
@@ -363,7 +363,7 @@ execute_command (const gchar * command)
g_debug("Issuing command '%s'", command);
if (!g_spawn_command_line_async(command, &error)) {
g_warning("Unable to start %s: %s", (char *)command, error->message);
- g_error_free(error);
+ g_clear_error (&error);
}
}
@@ -532,7 +532,7 @@ calendar_app_is_usable (void)
GSList *accounts_list = gconf_client_get_list (gconf, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL);
const guint n = g_slist_length (accounts_list);
g_debug ("found %u evolution accounts", n);
- g_slist_free (accounts_list);
+ g_slist_free_full (accounts_list, g_free);
return n > 0;
}
@@ -613,22 +613,43 @@ auth_func (ECal *ecal,
}
static gint
-compare_comp_instances (gconstpointer a,
- gconstpointer b)
+compare_comp_instances (gconstpointer ga, gconstpointer gb)
{
- const struct comp_instance *ci_a = a;
- const struct comp_instance *ci_b = b;
- time_t d = ci_a->start - ci_b->start;
- if (d < 0) return -1;
- else if (d > 0) return 1;
- return 0;
+ const struct comp_instance * a = ga;
+ const struct comp_instance * b = gb;
+
+ /* sort by start time */
+ if (a->start < b->start) return -1;
+ if (a->start > b->start) return 1;
+ return 0;
+}
+
+static struct comp_instance*
+comp_instance_new (ECalComponent * comp, time_t start, time_t end, ESource * source)
+{
+ g_debug("Using times start %s, end %s", ctime(&start), ctime(&end));
+
+ struct comp_instance *ci = g_new (struct comp_instance, 1);
+ ci->comp = g_object_ref (comp);
+ ci->source = source;
+ ci->start = start;
+ ci->end = end;
+ return ci;
+}
+static void
+comp_instance_free (struct comp_instance* ci)
+{
+ if (ci != NULL) {
+ g_clear_object (&ci->comp);
+ g_free (ci);
+ }
}
static gboolean
-populate_appointment_instances (ECalComponent *comp,
- time_t instance_start,
- time_t instance_end,
- gpointer data)
+populate_appointment_instances (ECalComponent * comp,
+ time_t start,
+ time_t end,
+ gpointer data)
{
g_debug("Appending item %p", comp);
@@ -638,20 +659,9 @@ populate_appointment_instances (ECalComponent *comp,
icalproperty_status status;
e_cal_component_get_status (comp, &status);
if (status == ICAL_STATUS_COMPLETED || status == ICAL_STATUS_CANCELLED) return FALSE;
-
- g_object_ref(comp);
- struct comp_instance *ci;
- ci = g_new (struct comp_instance, 1);
-
- g_debug("Using times start %s, end %s", ctime(&instance_start), ctime(&instance_end));
-
- ci->comp = comp;
- ci->source = E_SOURCE(data);
- ci->start = instance_start;
- ci->end = instance_end;
-
- comp_instances = g_list_append(comp_instances, ci);
+ struct comp_instance *ci = comp_instance_new (comp, start, end, E_SOURCE(data));
+ comp_instances = g_list_append (comp_instances, ci);
return TRUE;
}
@@ -719,25 +729,18 @@ update_appointment_menu_items (gpointer user_data)
if (!e_cal_get_sources(&sources, E_CAL_SOURCE_TYPE_EVENT, &gerror)) {
g_debug("Failed to get ecal sources\n");
+ g_clear_error (&gerror);
return FALSE;
}
- // Free comp_instances if not NULL
- if (comp_instances != NULL) {
- g_debug("Freeing comp_instances: may be an overlap\n");
- for (l = comp_instances; l; l = l->next) {
- const struct comp_instance *ci = l->data;
- g_object_unref(ci->comp);
- }
- g_list_free(comp_instances);
- comp_instances = NULL;
+ // clear any previous comp_instances
+ g_list_free_full (comp_instances, (GDestroyNotify)comp_instance_free);
+ comp_instances = NULL;
- }
GSList *cal_list = gconf_client_get_list(gconf, "/apps/evolution/calendar/display/selected_calendars", GCONF_VALUE_STRING, &gerror);
if (gerror) {
g_debug("Failed to get evolution preference for enabled calendars");
- g_error_free(gerror);
- gerror = NULL;
+ g_clear_error (&gerror);
cal_list = NULL;
}
@@ -759,39 +762,33 @@ update_appointment_menu_items (gpointer user_data)
}
if (current_zone && !e_cal_set_default_timezone(ecal, current_zone, &gerror)) {
g_debug("Failed to set ecal default timezone %s", gerror->message);
- g_error_free(gerror);
- gerror = NULL;
+ g_clear_error (&gerror);
g_object_unref(ecal);
continue;
}
if (!e_cal_open(ecal, FALSE, &gerror)) {
g_debug("Failed to get ecal sources %s", gerror->message);
- g_error_free(gerror);
- gerror = NULL;
+ g_clear_error (&gerror);
g_object_unref(ecal);
continue;
}
+
const gchar *ecal_uid = e_source_peek_uid(source);
- gboolean match = FALSE;
g_debug("Checking ecal_uid is enabled: %s", ecal_uid);
- for (i = 0; i<g_slist_length(cal_list);i++) {
- char *cuid = (char *)g_slist_nth_data(cal_list, i);
- if (g_strcmp0(cuid, ecal_uid) == 0) {
- match = TRUE;
- break;
- }
- }
- if (!match) {
+ const gboolean in_list = g_slist_find_custom (cal_list, ecal_uid, (GCompareFunc)g_strcmp0) != NULL;
+ if (!in_list) {
g_object_unref(ecal);
continue;
}
+
g_debug("ecal_uid is enabled, generating instances");
-
- e_cal_generate_instances (ecal, t1, t2, (ECalRecurInstanceFn) populate_appointment_instances, (gpointer) source);
+ e_cal_generate_instances (ecal, t1, t2, (ECalRecurInstanceFn) populate_appointment_instances, source);
g_object_unref(ecal);
}
}
+ g_slist_free_full (cal_list, g_free);
+
g_debug("Number of ECalComponents returned: %d", g_list_length(comp_instances));
GList *sorted_comp_instances = g_list_sort(comp_instances, compare_comp_instances);
comp_instances = NULL;
@@ -821,13 +818,12 @@ update_appointment_menu_items (gpointer user_data)
apt_output = SETTINGS_TIME_12_HOUR;
} else if (g_strcmp0(time_format_str, "24-hour") == 0) {
apt_output = SETTINGS_TIME_24_HOUR;
+ } else if (is_locale_12h()) {
+ apt_output = SETTINGS_TIME_12_HOUR;
} else {
- if (is_locale_12h()) {
- apt_output = SETTINGS_TIME_12_HOUR;
- } else {
- apt_output = SETTINGS_TIME_24_HOUR;
- }
+ apt_output = SETTINGS_TIME_24_HOUR;
}
+ g_free (time_format_str);
GVariantBuilder markeddays;
g_variant_builder_init (&markeddays, G_VARIANT_TYPE ("ai"));
@@ -1001,6 +997,7 @@ update_appointment_menu_items (gpointer user_data)
}
dbusmenu_menuitem_property_set_image (item, APPOINTMENT_MENUITEM_PROP_ICON, pixbuf);
+ g_clear_object (&pixbuf);
} else {
g_debug("Creating pixbuf from surface failed");
}
@@ -1010,15 +1007,15 @@ update_appointment_menu_items (gpointer user_data)
g_debug("Adding appointment: %p", item);
}
- if (gerror != NULL) g_error_free(gerror);
- for (l = sorted_comp_instances; l; l = l->next) {
- const struct comp_instance *ci = l->data;
- g_object_unref(ci->comp);
- }
- g_list_free(sorted_comp_instances);
+ g_clear_error (&gerror);
+
+ g_list_free_full (sorted_comp_instances, (GDestroyNotify)comp_instance_free);
+ sorted_comp_instances = NULL;
GVariant * marks = g_variant_builder_end (&markeddays);
dbusmenu_menuitem_property_set_variant (calendar, CALENDAR_MENUITEM_PROP_MARKS, marks);
+
+ g_clear_object (&sources);
updating_appointments = FALSE;
g_debug("End of objects");
@@ -1205,7 +1202,7 @@ system_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data)
if (error != NULL) {
g_warning("Could not grab DBus proxy for ConsoleKit: %s", error->message);
- g_error_free(error);
+ g_clear_error (&error);
return;
}
@@ -1218,6 +1215,7 @@ geo_address_cb (GeoclueAddress * address, int timestamp, GHashTable * addy_data,
{
if (error != NULL) {
g_warning("Unable to get Geoclue address: %s", error->message);
+ g_clear_error (&error);
return;
}
@@ -1279,6 +1277,7 @@ geo_create_address (GeoclueMasterClient * master, GeoclueAddress * address, GErr
{
if (error != NULL) {
g_warning("Unable to create GeoClue address: %s", error->message);
+ g_clear_error (&error);
return;
}
@@ -1305,6 +1304,7 @@ geo_req_set (GeoclueMasterClient * master, GError * error, gpointer user_data)
{
if (error != NULL) {
g_warning("Unable to set Geoclue requirements: %s", error->message);
+ g_clear_error (&error);
}
return;
}
@@ -1367,6 +1367,7 @@ geo_create_client (GeoclueMaster * master, GeoclueMasterClient * client, gchar *
if (error != NULL) {
g_warning("Unable to get a GeoClue client! '%s' Geolocation based timezone support will not be available.", error->message);
+ g_clear_error (&error);
return;
}