diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-06-07 14:04:57 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-06-09 13:30:53 -0400 |
commit | 1bb880af36d4dfbda743a6fa3c68815963549a49 (patch) | |
tree | 6e23256c8a4777170a70deb1a7e0ac0c4ca47be7 /gtk/gtkapplicationwindow.c | |
parent | 81c35b5b6efe1175b839a7fdeebcd371ef7010a9 (diff) | |
download | gtk+-1bb880af36d4dfbda743a6fa3c68815963549a49.tar.gz |
GtkApplicationWindow: Avoid a crash
In several places, we were not correctly dealing with the
possibility of application not being set.
Diffstat (limited to 'gtk/gtkapplicationwindow.c')
-rw-r--r-- | gtk/gtkapplicationwindow.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c index bf037ffcb3..aba45a75e7 100644 --- a/gtk/gtkapplicationwindow.c +++ b/gtk/gtkapplicationwindow.c @@ -298,9 +298,10 @@ gtk_application_window_update_shell_shows_app_menu (GtkApplicationWindow *window /* the shell does not show it, so make sure we show it */ if (g_menu_model_get_n_items (G_MENU_MODEL (window->priv->app_menu_section)) == 0) { - GMenuModel *app_menu; + GMenuModel *app_menu = NULL; - app_menu = gtk_application_get_app_menu (gtk_window_get_application (GTK_WINDOW (window))); + if (gtk_window_get_application (GTK_WINDOW (window)) != NULL) + app_menu = gtk_application_get_app_menu (gtk_window_get_application (GTK_WINDOW (window))); if (app_menu != NULL) { @@ -347,9 +348,10 @@ gtk_application_window_update_shell_shows_menubar (GtkApplicationWindow *window, /* the shell does not show it, so make sure we show it */ if (g_menu_model_get_n_items (G_MENU_MODEL (window->priv->menubar_section)) == 0) { - GMenuModel *menubar; + GMenuModel *menubar = NULL; - menubar = gtk_application_get_menubar (gtk_window_get_application (GTK_WINDOW (window))); + if (gtk_window_get_application (GTK_WINDOW (window)) != NULL) + menubar = gtk_application_get_menubar (gtk_window_get_application (GTK_WINDOW (window))); if (menubar != NULL) g_menu_append_section (window->priv->menubar_section, NULL, menubar); |