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 493176 - gimp_tool_set_active_modifier_state assertion failed
gimp_tool_set_active_modifier_state assertion failed
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
2.4.x
Other All
: Normal normal
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2007-11-03 20:43 UTC by Ari Pollak
Modified: 2008-10-30 20:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Please try if this patch fixes the problem (1.18 KB, patch)
2007-12-07 11:16 UTC, Michael Natterer
committed Details | Review

Description Ari Pollak 2007-11-03 20:43:03 UTC
From Debian bug report http://bugs.debian.org/448525:

I choose rectangle select, and when I finally release the mouse after
pulling out the rectangle, the following message shows up on the console, though everything seems to work fine.
Gimp-Tools-CRITICAL **: gimp_tool_set_active_modifier_state: assertion `display == tool->focus_display' failed

Backtrace from the warning:

  • #0 __kernel_vsyscall
  • #1 raise
    from /lib/i686/cmov/libc.so.6
  • #2 abort
    from /lib/i686/cmov/libc.so.6
  • #3 g_logv
    from /usr/lib/libglib-2.0.so.0
  • #4 g_log
    from /usr/lib/libglib-2.0.so.0
  • #5 g_return_if_fail_warning
    from /usr/lib/libglib-2.0.so.0
  • #6 gimp_tool_button_release
    at /build/buildd/gimp-2.4.0/./app/tools/gimptool.c line 595
  • #7 gimp_display_shell_canvas_tool_events
    at /build/buildd/gimp-2.4.0/./app/display/gimpdisplayshell-callbacks.c line 957
  • #8 ??
    from /usr/lib/libgtk-x11-2.0.so.0
  • #9 ??
  • #10 ??
  • #11 ??
  • #12 ??
    from /usr/lib/libgobject-2.0.so.0
  • #13 ??
    from /usr/lib/libgtk-x11-2.0.so.0
  • #14 ??
  • #15 ??
  • #16 g_closure_invoke
    from /usr/lib/libgobject-2.0.so.0

Comment 1 Martin Nordholts 2007-11-03 21:09:34 UTC
The reporter will need to provide more info as this does not seem to be enough for reproducing. For example, what tool (and how) did he use before using the Rectangle Select Tool?
Comment 2 Ari Pollak 2007-11-03 21:28:51 UTC
The user seems to get the message whenever he uses the tool, even if it's the first thing he uses after staring up gimp.
Comment 3 Juho Saarikko 2007-12-05 15:50:33 UTC
I have a propably related bug report, on Gimp 2.4.2:

I recently bought a Wacom Bamboo tablet, and after fighting kernel, X and GTK, finally managed to get Gimp to recognize it as an extended input device. However, now Gimp crashes with the same error message than the original author (no backtrace, sorry) when I lift the stylys from the pad after drawing a stroke with the brush tool.

I experimented a bit more with it and noticed that if I select any tool at all with the mouse before using the stylus the first time, everything works fine.

GTK is version 2.12.2. Also, this Linux installation began its life as Red Hat 9, and has since been updated beyond all recognition, so this _could_ conceivably be some weird library issue or something. 
Comment 4 weskaggs 2007-12-06 00:28:38 UTC
A stack trace would be incredibly helpful.  If you're not sure how to get one, please ask and I'll tell you.
Comment 5 Juho Saarikko 2007-12-06 23:46:53 UTC
I configured Gimp 2.4.2 with --enable-debug. I've attached the backtrace and all other console output at the end of this message. Please tell if you need something more.

Furthermore, I've done some additional testing. This bug is triggered (at least in the debug version) if, and only if, GIMP switches automatically to another tool than the currently selected one when it start receiving input from the stylus, as soon as I lift the stylus.

In my previous report, for whatever reason the default tool when GIMP started was the finger thing (smudge ?), and GIMP switched to a brush as I used the stylus.

Anyway, debugger output follows.

***
[bin]$ gdb ./gimp-2.4
GNU gdb 6.7
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /home/juho/gimpdebug/bin/gimp-2.4
[Thread debugging using libthread_db enabled]
[New Thread 0xa73f86b0 (LWP 4394)]
 
Gimp-Tools-CRITICAL **: gimp_tool_set_active_modifier_state: assertion `display == tool->focus_display' failed
aborting...
 
Program received signal SIGABRT, Aborted.

Thread 2805958320 (LWP 4394)

  • #0 __kernel_vsyscall
  • #1 *__GI_raise
    at ../nptl/sysdeps/unix/sysv/linux/raise.c line 64
  • #2 *__GI_abort
    at abort.c line 88
  • #3 IA__g_logv
    at gmessages.c line 497
  • #4 IA__g_log
    at gmessages.c line 517
  • #5 IA__g_return_if_fail_warning
    at gmessages.c line 532
  • #6 gimp_tool_button_release
    at gimptool.c line 595
  • #7 gimp_display_shell_canvas_tool_events
    at gimpdisplayshell-callbacks.c line 958
  • #8 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 84
  • #9 IA__g_closure_invoke
    at gclosure.c line 490
  • #10 signal_emit_unlocked_R
    at gsignal.c line 2440
  • #11 IA__g_signal_emit_valist
    at gsignal.c line 2209
  • #12 IA__g_signal_emit
    at gsignal.c line 2243
  • #13 gtk_widget_event_internal
    at gtkwidget.c line 4675
  • #14 IA__gtk_propagate_event
    at gtkmain.c line 2318
  • #15 IA__gtk_main_do_event
    at gtkmain.c line 1538
  • #16 gdk_event_dispatch
    at gdkevents-x11.c line 2351
  • #17 IA__g_main_context_dispatch
    at gmain.c line 2061
  • #18 g_main_context_iterate
    at gmain.c line 2694
  • #19 IA__g_main_loop_run
    at gmain.c line 2898
  • #20 app_run
    at app.c line 246
  • #21 main
    at main.c line 385

Comment 6 Juho Saarikko 2007-12-07 00:26:48 UTC
I did some more testing and debugging, and the bug seems to happen randomly even if I have used another tool before; however, the common factor is that tool->focus_display on the stack frame 6 (the backtrace is also always the same) is always 0x0.
Comment 7 weskaggs 2007-12-07 01:59:51 UTC
Great, that's very helpful.  I think it's likely that the problem was caused by some recent changes mitch made.  There is another thing you could do that might shed further light:  go into the "app" directory and run "touch tools/gimptool.c", then, as root, "DEBUG_FOCUS=true make install".  This should enable some debugging output that mitch set up.  Then run gimp again in a way that produces the error, and note the messages that appear on the console, and add them here.  There's no need for another stack trace, it wouldn't be any different.
Comment 8 Sven Neumann 2007-12-07 07:32:47 UTC
Setting the DEBUG_FOCUS environment variable is not going to have any effect. You need to set -DDEBUG_FLAGS in the CPP_FLAGS environment variable and reconfigure. But it's a lot simpler to just edit app/tools/gimp-tool.c and add the line

 #define DEBUG_FOCUS 1

somewhere at the top of the file.

And you wouldn't run make as root. Root privileges are only needed for installing the resulting executable. But you can just run it directly from the app directory.
Comment 9 Juho Saarikko 2007-12-07 10:48:30 UTC
I did as Neumann said. The actions taken here:

1. I started GIMP.

2. Using the stylus as a mouse, I created a new image.

3. I drew a stroke with the stylys and the brush tool.

4. Using the normal mouse (PS/2) I selected the pencil tool and drew a stroke.

5. Using the stylys (which automatically selected the brush again) I drew a stroke.

6. The program crashed.


***

[bin]$ ./gimp-2.4
gimp_tool_set_focus_display: tool: 0x8544318  display: 0x8cdf7b0  focus_display: (nil)
gimp_tool_set_modifier_state: tool: 0x8544318  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x8544318  display: (nil)  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x8544318  display: 0x8cdf7b0  focus_display: (nil)
gimp_tool_set_modifier_state: tool: 0x8544318  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x8544318  display: (nil)  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x8544318  display: 0x8cdf7b0  focus_display: (nil)
gimp_tool_set_modifier_state: tool: 0x8544318  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x8544318  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_modifier_state: tool: 0x8544318  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x8544318  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_modifier_state: tool: 0x8544318  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x8544318  display: (nil)  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x8544318  display: (nil)  focus_display: (nil)
gimp_tool_set_focus_display: tool: 0x84f1c30  display: (nil)  focus_display: (nil)
gimp_tool_set_focus_display: tool: 0x877b900  display: 0x8cdf7b0  focus_display: (nil)
gimp_tool_set_modifier_state: tool: 0x877b900  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x877b900  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_modifier_state: tool: 0x877b900  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x877b900  display: (nil)  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x877b9e8  display: (nil)  focus_display: (nil)
gimp_tool_set_focus_display: tool: 0x877b9e8  display: 0x8cdf7b0  focus_display: (nil)
gimp_tool_set_modifier_state: tool: 0x877b9e8  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x877b9e8  display: (nil)  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x877bad0  display: (nil)  focus_display: (nil)
gimp_tool_set_focus_display: tool: 0x877bbb8  display: (nil)  focus_display: (nil)
gimp_tool_set_focus_display: tool: 0x877bbb8  display: 0x8cdf7b0  focus_display: (nil)
gimp_tool_set_modifier_state: tool: 0x877bbb8  display: 0x8cdf7b0  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x877bbb8  display: (nil)  focus_display: 0x8cdf7b0
gimp_tool_set_focus_display: tool: 0x877bca0  display: (nil)  focus_display: (nil)
 
Gimp-Tools-CRITICAL **: gimp_tool_set_active_modifier_state: assertion `display == tool->focus_display' failed
aborting...
./gimp-2.4: terminated: Aborted
 
(script-fu:5960): LibGimpBase-WARNING **: script-fu: gimp_wire_read(): error
[bin]$
Comment 10 Michael Natterer 2007-12-07 11:16:50 UTC
Created attachment 100512 [details] [review]
Please try if this patch fixes the problem
Comment 11 Juho Saarikko 2007-12-07 15:37:53 UTC
I've applied the patch, and in five minutes of testing haven't managed to get GIMP to crash. I'll test it some more and let you know the results.
Comment 12 Juho Saarikko 2007-12-07 16:37:02 UTC
Okay, it is certainly less crash-prone with the patch, but it crash once when using intelligent scissors, with the same error message as before.
Comment 13 Michael Natterer 2007-12-07 18:45:23 UTC
Thanks, but does it really crash when that warning happens? Or does
it just crash because you passed --g-fatal-warnings on the command line?
Comment 14 Michael Natterer 2007-12-07 18:46:46 UTC
Oh, and can you please tell us the exact steps that lead to the
intelligent scissors warning?
Comment 15 Michael Natterer 2007-12-07 18:58:43 UTC
Comitted the attached patch. Will backport as soon as the intelligent
scissors warning is fixed too:

2007-12-07  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplayshell-callbacks.c
	(gimp_display_shell_tool_events): if a device change happens, make
	sure we update the new active tool's focus display and modifier
	state. Fixes most of bug #493176.
Comment 16 Sven Neumann 2007-12-10 19:53:26 UTC
I have backported this change, we might want to do a 2.4.3 release soon...

2007-12-10  Sven Neumann  <sven@gimp.org>

	Merged from trunk:

	* app/display/gimpdisplayshell-callbacks.c
	(gimp_display_shell_tool_events): if a device change happens, make
	sure we update the new active tool's focus display and modifier
	state. Fixes most of bug #493176.
Comment 17 Sven Neumann 2007-12-12 11:27:02 UTC
Juho, can you please answer the question in comment #14 and explain us how to trigger the warning from intelligent scissors? Perhaps it would even be a good idea to open a separate bug report for it.
Comment 18 Juho Saarikko 2007-12-31 23:35:31 UTC
Sorry about the delay, I've been away for a while.

I haven't been able to trigger the scissors bug again, so it might simply be a freak occurence. I did, at the time it happened, have several versions installed side-by-side, so it could conceivably have been some sort of interference.

Will inform you if I see this again, but for now, the bug seems to be fixed in 2.4.3.
Comment 19 Michael Natterer 2008-01-02 10:29:10 UTC
Cool, closing as FIXED then.