[gnome-photos] application: Fix the check to detect if we were the primary instance



commit e23554ecbd947675944a9a3080007b16573e2db7
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jun 17 17:09:08 2016 +0200

    application: Fix the check to detect if we were the primary instance
    
    Reading the GApplication implementation confirms that the startup and
    shutdown signals are called (ie. an instance is primary) when:
      * GApplication:is-registered == TRUE
      * GApplication:is-remote == FALSE
    
    Fixing the primary instance detection will help prevent a CRITICAL when
    we handle local command line options (eg., --version) via the
    handle-local-options signal handler
    
    GApplication::handle-local-options is emitted before the local
    GApplication has had a chance to register. It will register only if
    handle_local_options returns a negative value. Otherwise, it will exit
    without calling g_application_register.
    
    When exiting, GApplication:is-registered is FALSE. Therefore, calling
    g_application_get_is_remote will lead to:
      GLib-GIO-CRITICAL **: g_application_get_is_remote: assertion
        'application->priv->is_registered' failed
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760796

 src/photos-application.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 487c9c4..5d9db80 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -1647,7 +1647,7 @@ photos_application_finalize (GObject *object)
 
   g_assert (self->create_miners_count == 0);
 
-  if (!g_application_get_is_remote (G_APPLICATION (self)))
+  if (g_application_get_is_registered (G_APPLICATION (self)) && !g_application_get_is_remote (G_APPLICATION 
(self)))
     gegl_exit ();
 
   G_OBJECT_CLASS (photos_application_parent_class)->finalize (object);


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