Commit 157d9271 authored by Cosimo Cecchi's avatar Cosimo Cecchi

application: don't unconditionally unref the GMenuModel in getters

Both the app-menu and menubar models can be NULL, so we shouldn't
blindly unref them, since g_object_unref() doesn't cope with NULL
pointers.
parent 72c04c06
......@@ -792,10 +792,12 @@ gtk_application_set_app_menu (GtkApplication *application,
GMenuModel *
gtk_application_get_app_menu (GtkApplication *application)
{
GMenuModel *app_menu;
GMenuModel *app_menu = NULL;
g_object_get (application, "app-menu", &app_menu, NULL);
g_object_unref (app_menu);
if (app_menu)
g_object_unref (app_menu);
return app_menu;
}
......@@ -840,10 +842,12 @@ gtk_application_set_menubar (GtkApplication *application,
GMenuModel *
gtk_application_get_menubar (GtkApplication *application)
{
GMenuModel *menubar;
GMenuModel *menubar = NULL;
g_object_get (application, "menubar", &menubar, NULL);
g_object_unref (menubar);
if (menubar)
g_object_unref (menubar);
return menubar;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment