From 687d3eb48f864bd7255b59a9eb9d77b851b341a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Wilmet?= Date: Sun, 10 Apr 2016 14:15:35 +0200 Subject: [PATCH] app: use g_set_object() https://bugzilla.gnome.org/show_bug.cgi?id=764846 --- gtk/gtkapplication.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c index fa6e99e2ef..49c7dd7fdc 100644 --- a/gtk/gtkapplication.c +++ b/gtk/gtkapplication.c @@ -1383,16 +1383,8 @@ gtk_application_set_app_menu (GtkApplication *application, g_return_if_fail (g_application_get_is_registered (G_APPLICATION (application))); g_return_if_fail (!g_application_get_is_remote (G_APPLICATION (application))); - if (app_menu != application->priv->app_menu) + if (g_set_object (&application->priv->app_menu, app_menu)) { - if (application->priv->app_menu != NULL) - g_object_unref (application->priv->app_menu); - - application->priv->app_menu = app_menu; - - if (application->priv->app_menu != NULL) - g_object_ref (application->priv->app_menu); - if (app_menu) extract_accels_from_menu (app_menu, application); @@ -1456,16 +1448,8 @@ gtk_application_set_menubar (GtkApplication *application, g_return_if_fail (g_application_get_is_registered (G_APPLICATION (application))); g_return_if_fail (!g_application_get_is_remote (G_APPLICATION (application))); - if (menubar != application->priv->menubar) + if (g_set_object (&application->priv->menubar, menubar)) { - if (application->priv->menubar != NULL) - g_object_unref (application->priv->menubar); - - application->priv->menubar = menubar; - - if (application->priv->menubar != NULL) - g_object_ref (application->priv->menubar); - if (menubar) extract_accels_from_menu (menubar, application);