After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 330981 - Application crashes if 'Refresh scripts' is chosen while a Script-fu dialog is still open
Application crashes if 'Refresh scripts' is chosen while a Script-fu dialog i...
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Script-Fu
2.2.x
Other All
: Normal major
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-02-13 12:17 UTC by Fritz Jetzek
Modified: 2008-01-15 13:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Show message if "Refresh Scripts" is used when Script-Fu dialog box is open (2.29 KB, patch)
2006-06-03 00:08 UTC, Kevin Cozens
needs-work Details | Review
Second version of patch to prevent 'Refresh Scripts' when Script-Fu dialog is open (1.75 KB, patch)
2006-06-05 16:04 UTC, Kevin Cozens
needs-work Details | Review

Description Fritz Jetzek 2006-02-13 12:17:41 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

Thread 1 (Thread 16384 (LWP 12986))

  • #0 poll
    from /lib/libc.so.6
  • #1 g_main_context_check
    from /usr/lib/libglib-2.0.so.0
  • #2 g_main_context_check
    from /usr/lib/libglib-2.0.so.0
  • #3 g_main_context_check
    from /usr/lib/libglib-2.0.so.0
  • #4 g_main_context_check
    from /usr/lib/libglib-2.0.so.0
  • #5 g_main_context_check
    from /usr/lib/libglib-2.0.so.0
  • #6 g_main_context_check
    from /usr/lib/libglib-2.0.so.0

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.
Comment 1 Michael Schumacher 2006-02-13 13:10:04 UTC
I can only reproduce this if I cancel the script, no problems so far for 'Ok'.
Comment 2 Fritz Jetzek 2006-02-13 13:23:04 UTC
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.
Comment 3 Sven Neumann 2006-02-14 10:41:16 UTC
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.
Comment 4 Kevin Cozens 2006-06-02 18:22:39 UTC
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.
Comment 5 Sven Neumann 2006-06-02 19:18:27 UTC
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.
Comment 6 Kevin Cozens 2006-06-03 00:08:42 UTC
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.
Comment 7 Michael Natterer 2006-06-03 13:43:20 UTC
Please follow the coding style and the namespace in the touched files.
Comment 8 Michael Natterer 2006-06-03 13:43:51 UTC
Also, a boolean is a gboolean, not a gint.
Comment 9 Kevin Cozens 2006-06-05 16:04:09 UTC
Created attachment 66782 [details] [review]
Second version of patch to prevent 'Refresh Scripts' when Script-Fu dialog is open
Comment 10 Michael Natterer 2006-06-05 17:24:21 UTC
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?
Comment 11 Sven Neumann 2006-06-06 17:50:21 UTC
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.