[gtk+] gtkapplication: fix some crashing "leak fixes"



commit 85700627aac04222599a38bfc373cdaae0c91148
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Sep 20 14:22:52 2012 -0400

    gtkapplication: fix some crashing "leak fixes"
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684258

 examples/bloatpad.c  |    1 +
 gtk/gtkapplication.c |    8 +++-----
 2 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/examples/bloatpad.c b/examples/bloatpad.c
index fc8e263..8d0da4e 100644
--- a/examples/bloatpad.c
+++ b/examples/bloatpad.c
@@ -366,6 +366,7 @@ bloat_pad_startup (GApplication *application)
                                "</interface>", -1, NULL);
   gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
   gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
+  //gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
   bloatpad->time = G_MENU (gtk_builder_get_object (builder, "time-menu"));
   g_object_unref (builder);
 }
diff --git a/gtk/gtkapplication.c b/gtk/gtkapplication.c
index 907b3fe..334cb9f 100644
--- a/gtk/gtkapplication.c
+++ b/gtk/gtkapplication.c
@@ -219,7 +219,6 @@ static void
 gtk_application_set_app_menu_x11 (GtkApplication *application,
                                   GMenuModel     *app_menu)
 {
-  g_free (application->priv->app_menu_path);
   gtk_application_x11_publish_menu (application, "appmenu", app_menu,
                                     &application->priv->app_menu_id,
                                     &application->priv->app_menu_path);
@@ -229,7 +228,6 @@ static void
 gtk_application_set_menubar_x11 (GtkApplication *application,
                                  GMenuModel     *menubar)
 {
-  g_free (application->priv->menubar_path);
   gtk_application_x11_publish_menu (application, "menubar", menubar,
                                     &application->priv->menubar_id,
                                     &application->priv->menubar_path);
@@ -294,13 +292,13 @@ gtk_application_shutdown_x11 (GtkApplication *application)
   application->priv->session_bus = NULL;
   application->priv->object_path = NULL;
 
+  gtk_application_set_app_menu_x11 (application, NULL);
+  gtk_application_set_menubar_x11 (application, NULL);
+
   g_clear_object (&application->priv->sm_proxy);
   g_clear_object (&application->priv->client_proxy);
   g_free (application->priv->app_id);
   g_free (application->priv->client_path);
-
-  g_free (application->priv->app_menu_path);
-  g_free (application->priv->menubar_path);
 }
 
 const gchar *



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