[sound-juicer] Move cleanup to shutdown_cb()



commit 1289fc10f06dc9c6f2ced72bea8d67eb162eb89e
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Wed Jan 25 18:40:08 2017 +0000

    Move cleanup to shutdown_cb()
    
    Only perform cleanup in the primary instance. This fixes some
    ‘g_object_unref: assertion 'G_IS_OBJECT (object)' failed’
    warnings when starting a second instance.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777785

 src/sj-main.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/sj-main.c b/src/sj-main.c
index d1f3abf..491c498 100644
--- a/src/sj-main.c
+++ b/src/sj-main.c
@@ -2053,6 +2053,17 @@ startup_cb (GApplication *app, gpointer user_data)
 }
 
 static void
+shutdown_cb (GApplication *app, gpointer user_data)
+{
+  sj_metadata_helper_cleanup ();
+  g_object_unref (sj_base_uri);
+  g_object_unref (metadata);
+  g_object_unref (sj_extractor);
+  g_object_unref (sj_settings);
+  brasero_media_library_stop ();
+}
+
+static void
 activate_cb (GApplication *app, gpointer user_data)
 {
   gtk_window_present (GTK_WINDOW (main_window));
@@ -2162,18 +2173,12 @@ int main (int argc, char **argv)
 
   g_object_set (app, "register-session", TRUE, NULL);
   g_signal_connect (app, "startup", G_CALLBACK (startup_cb), NULL);
+  g_signal_connect (app, "shutdown", G_CALLBACK (shutdown_cb), NULL);
   g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);
 
   status = g_application_run (G_APPLICATION (app), argc, argv);
 
   g_object_unref (app);
 
-  sj_metadata_helper_cleanup ();
-  g_object_unref (sj_base_uri);
-  g_object_unref (metadata);
-  g_object_unref (sj_extractor);
-  g_object_unref (sj_settings);
-  brasero_media_library_stop ();
-
   return status;
 }


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