[evolution-data-server/gnome-3-6] source_remove_sync: Fail gracefully when given a scratch source.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-6] source_remove_sync: Fail gracefully when given a scratch source.
- Date: Tue, 19 Feb 2013 14:29:48 +0000 (UTC)
commit 035a1281a723c9e4e67f04eeced4420587d3620a
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Feb 19 09:22:46 2013 -0500
source_remove_sync: Fail gracefully when given a scratch source.
Apparently e_dbus_object_get_source_removable() does not check its
argument for NULL, and scratch sources have no internal EDBusObject.
(cherry picked from commit a8eb939af5623eeb4b5fe24cfcde022d954f4d17)
libedataserver/e-source.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index c8f1164..255d03c 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -923,15 +923,19 @@ source_remove_sync (ESource *source,
GCancellable *cancellable,
GError **error)
{
- EDBusObject *dbus_object;
- EDBusSourceRemovable *dbus_source;
+ EDBusSourceRemovable *dbus_interface = NULL;
+ GDBusObject *dbus_object;
gboolean success;
- dbus_object = E_DBUS_OBJECT (source->priv->dbus_object);
-
- dbus_source = e_dbus_object_get_source_removable (dbus_object);
+ dbus_object = e_source_ref_dbus_object (source);
+ if (dbus_object != NULL) {
+ dbus_interface =
+ e_dbus_object_get_source_removable (
+ E_DBUS_OBJECT (dbus_object));
+ g_object_unref (dbus_object);
+ }
- if (dbus_source == NULL) {
+ if (dbus_interface == NULL) {
g_set_error (
error, G_IO_ERROR,
G_IO_ERROR_PERMISSION_DENIED,
@@ -941,9 +945,9 @@ source_remove_sync (ESource *source,
}
success = e_dbus_source_removable_call_remove_sync (
- dbus_source, cancellable, error);
+ dbus_interface, cancellable, error);
- g_object_unref (dbus_source);
+ g_object_unref (dbus_interface);
return success;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]