diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-02-19 09:22:46 -0500 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-02-19 09:29:55 -0500 |
commit | 035a1281a723c9e4e67f04eeced4420587d3620a (patch) | |
tree | 4faac3c909b332a7cc64777b93af9c98288302f4 | |
parent | fc24a7a7876de42b01ec49a3d9d8e48abcf426be (diff) | |
download | evolution-data-server-035a1281a723c9e4e67f04eeced4420587d3620a.tar.gz |
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)
-rw-r--r-- | 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 c8f1164bf..255d03c18 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; } |