[gnome-photos] thumbnailer: Assert that the skeleton's lifetime is sane
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] thumbnailer: Assert that the skeleton's lifetime is sane
- Date: Mon, 12 Jun 2017 21:56:57 +0000 (UTC)
commit b50eb8d7680e5af97c3695dd607bcde63eab65f3
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Jun 8 15:40:42 2017 +0200
thumbnailer: Assert that the skeleton's lifetime is sane
Clearing the reference during dispose might mask an actual bug.
The skeleton should be instantiated in the dbus_register virtual
method, which is expected to be called only once. If instantiated, it
should then be torn down in dbus_unregister, which might be invoked
more than once.
src/photos-thumbnailer.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-thumbnailer.c b/src/photos-thumbnailer.c
index e7dbcbb..cec79c0 100644
--- a/src/photos-thumbnailer.c
+++ b/src/photos-thumbnailer.c
@@ -672,6 +672,8 @@ photos_thumbnailer_dbus_register (GApplication *application,
GDBusAuthObserver *observer = NULL;
gboolean ret_val = FALSE;
+ g_return_val_if_fail (self->skeleton == NULL, FALSE);
+
if (!G_APPLICATION_CLASS (photos_thumbnailer_parent_class)->dbus_register (application,
connection,
object_path,
@@ -780,8 +782,9 @@ photos_thumbnailer_dispose (GObject *object)
{
PhotosThumbnailer *self = PHOTOS_THUMBNAILER (object);
+ g_assert_null (self->skeleton);
+
g_clear_object (&self->connection);
- g_clear_object (&self->skeleton);
g_clear_pointer (&self->cancellables, (GDestroyNotify) g_hash_table_unref);
g_clear_pointer (&self->resource_gegl, (GDestroyNotify) g_resources_unregister);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]