Commit c6e33b67fc3b6043af56e041b3684e82f0a86a95
1 parent
781c9f0a
Exists in
master
and in
2 other branches
Fixing toolbar segfault on application exit.
Showing
2 changed files
with
8 additions
and
1 deletions
Show diff stats
src/objects/toolbar/actions.c
@@ -58,7 +58,7 @@ | @@ -58,7 +58,7 @@ | ||
58 | 58 | ||
59 | GtkWidget * window = gtk_widget_get_toplevel(toolbar); | 59 | GtkWidget * window = gtk_widget_get_toplevel(toolbar); |
60 | 60 | ||
61 | - if(window) { | 61 | + if(window && G_IS_ACTION_MAP(window)) { |
62 | 62 | ||
63 | GtkToolItem * item = NULL; | 63 | GtkToolItem * item = NULL; |
64 | GAction *action = g_action_map_lookup_action(G_ACTION_MAP(window), name); | 64 | GAction *action = g_action_map_lookup_action(G_ACTION_MAP(window), name); |
src/objects/toolbar/toolbar.c
@@ -363,6 +363,13 @@ | @@ -363,6 +363,13 @@ | ||
363 | 363 | ||
364 | void pw3270_toolbar_set_actions(GtkWidget *toolbar, const gchar *action_names) { | 364 | void pw3270_toolbar_set_actions(GtkWidget *toolbar, const gchar *action_names) { |
365 | 365 | ||
366 | + // The action search requires a toplevel window. | ||
367 | + if(!gtk_widget_get_parent(toolbar)) { | ||
368 | + g_warning("Can't set actions on an orphan toolbar"); | ||
369 | + return; | ||
370 | + } | ||
371 | + | ||
372 | + // Split action names | ||
366 | size_t ix; | 373 | size_t ix; |
367 | gint pos = 0; | 374 | gint pos = 0; |
368 | 375 |