GNOME Bugzilla – Bug 330981
Application crashes if 'Refresh scripts' is chosen while a Script-fu dialog is still open
Last modified: 2008-01-15 13:05:12 UTC
Steps to reproduce: 1. Start any Script-fu script that pops up dialogs, e.g. "Xtns->Script-Fu->Buttons->Round Button...". Wait for the dialog window to appear. 2. Choose "Xtns->Script-Fu->Refresh Scripts". 3. Click on the "OK" button of the open dialog. Stack trace: crashcut@hanoi (~)> gdb gimp GNU gdb 6.3-debian Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "powerpc-linux"...Using host libthread_db library "/lib/libthread_db.so.1". (gdb) run Starting program: /usr/bin/gimp [Thread debugging using libthread_db enabled] [New Thread 16384 (LWP 12986)] /usr/lib/gimp/2.0/plug-ins/script-fu: fatal error: Segmentation fault Program received signal SIGINT, Interrupt. [Switching to Thread 16384 (LWP 12986)] 0x0f228f70 in poll () from /lib/libc.so.6 (gdb) thread apply all bt
+ Trace 66132
Thread 1 (Thread 16384 (LWP 12986))
Other information: The crash appears to be reproducible with any Script-Fu script that pops up a dialog for options. The application crashes whenever scripts are refreshed _after_ starting a dialog-driven script and _before_ running that script.
I can only reproduce this if I cancel the script, no problems so far for 'Ok'.
Checking all pushbuttons: 'Help' and 'Cancel' crash Script-Fu (with the main application continuing to run); 'Reset' and 'Ok' crash whole application. Kernel is 2.6.8-powerpc.
This will be non-trivial to fix because the scripts may change their parameters. Probably the best thing to do here is to close all script-fu dialogs whenever the scripts are refreshed. We will however have to add a warning dialog that informs the user about this.
When a script-fu dialog box is active the sf_interface variable in script-fu-interface.c is set to a non-NULL value. The variable is currently declared as static. It may be trivial to check the value sf_itnerface and, if it is non-NULL, display a message to users that they can't refresh scripts when a script-fu dialog box is active. The routine that closes a script-fu dialog box needs a pointer to an SFScript structure so it is non-trivial to close an open dialog box prior to running refresh scripts.
Sounds like a very reasonable approach. Let's add such dialog in the HEAD branch. We can check later if this should be backported also.
Created attachment 66682 [details] [review] Show message if "Refresh Scripts" is used when Script-Fu dialog box is open This patch will display a message to the user if they try to use the "Refresh Scripts" menu entry when a Script-Fu script has already opened a dialog box.
Please follow the coding style and the namespace in the touched files.
Also, a boolean is a gboolean, not a gint.
Created attachment 66782 [details] [review] Second version of patch to prevent 'Refresh Scripts' when Script-Fu dialog is open
I still don't see how is_script_fu_dialog_open() matches the namespace of a file where all other functions are called script_fu_interface_foo(). Doesn't this jump at your eyes and hurts badly?
2006-06-06 Sven Neumann <sven@gimp.org> * plug-ins/script-fu/script-fu-interface.[ch] * plug-ins/script-fu/script-fu.c (script_fu_refresh_proc): applied a modified patch from Kevin Cozens. Fixes bug #330981.