Commit c6e33b67fc3b6043af56e041b3684e82f0a86a95

Authored by Perry Werneck
1 parent 781c9f0a

Fixing toolbar segfault on application exit.

src/objects/toolbar/actions.c
... ... @@ -58,7 +58,7 @@
58 58  
59 59 GtkWidget * window = gtk_widget_get_toplevel(toolbar);
60 60  
61   - if(window) {
  61 + if(window && G_IS_ACTION_MAP(window)) {
62 62  
63 63 GtkToolItem * item = NULL;
64 64 GAction *action = g_action_map_lookup_action(G_ACTION_MAP(window), name);
... ...
src/objects/toolbar/toolbar.c
... ... @@ -363,6 +363,13 @@
363 363  
364 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 373 size_t ix;
367 374 gint pos = 0;
368 375  
... ...