[evolution-data-server] 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] source_remove_sync: Fail gracefully when given a scratch source.
- Date: Tue, 19 Feb 2013 14:28:34 +0000 (UTC)
commit a8eb939af5623eeb4b5fe24cfcde022d954f4d17
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.
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 9f340f6..f1c33e0 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -924,15 +924,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,
@@ -942,9 +946,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]