[gnome-photos] application: Assert that the SearchProvider's lifetime is sane



commit e39344cce7d85397baba7f5360f51eaa18f9c780
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Jun 8 14:48:32 2017 +0200

    application: Assert that the SearchProvider's lifetime is sane
    
    The SearchProvider 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-application.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index b503653..48fb9a1 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -1598,6 +1598,8 @@ photos_application_dbus_register (GApplication *application,
   gboolean ret_val = FALSE;
   gchar *search_provider_path = NULL;
 
+  g_return_val_if_fail (self->search_provider == NULL, FALSE);
+
   if (!G_APPLICATION_CLASS (photos_application_parent_class)->dbus_register (application,
                                                                              connection,
                                                                              object_path,
@@ -1974,6 +1976,8 @@ photos_application_dispose (GObject *object)
 {
   PhotosApplication *self = PHOTOS_APPLICATION (object);
 
+  g_assert_null (self->search_provider);
+
   if (self->miners_running != NULL)
     {
       g_list_free_full (self->miners_running, g_object_unref);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]