From 2b66cd7a7eec8b1d9394eb7e5feda0be3c7d47d3 Mon Sep 17 00:00:00 2001 From: Peter Clifton Date: Sat, 24 Dec 2011 17:14:04 +0000 Subject: [PATCH] hid/gtk: Fix NetlistChanged action crash when exporting from the commandline. I broke this in commit 7308f512307158944482227d58e66373fd023d62 when I added a missing notification to the GUI when free'ing the netlist. It turns out that a command-line invoked export (such as used to export images in the doc/ build) will hit this code-path, and provoke the GUI netlist window code to try and update before the GUI is actually loaded. For now, lets fix this with a bandaid and just skip the netlist update if the GUI is not up. A brief inspection of the code (and test for the doc/ build) suggests that the Lesstif HID is not affected by this problem. (It has similar code to avoid creating the netlist window if the main window is not already created). --- src/hid/gtk/gui-netlist-window.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hid/gtk/gui-netlist-window.c b/src/hid/gtk/gui-netlist-window.c index 447b10e28c..249066f0e1 100644 --- a/src/hid/gtk/gui-netlist-window.c +++ b/src/hid/gtk/gui-netlist-window.c @@ -1009,6 +1009,11 @@ ghid_netlist_window_update (gboolean init_nodes) static gint GhidNetlistChanged (int argc, char **argv, Coord x, Coord y) { + /* XXX: We get called before the GUI is up when + * exporting from the command-line. */ + if (ghidgui == NULL || !ghidgui->is_up) + return 0; + loading_new_netlist = TRUE; ghid_netlist_window_update (TRUE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (disable_all_button), -- 2.11.4.GIT