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 313922 - Crash doubleclicking in move tool with floating selection
Crash doubleclicking in move tool with floating selection
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
git master
Other All
: Normal critical
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2005-08-19 05:11 UTC by Akkana Peck
Modified: 2005-08-20 12:36 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Akkana Peck 2005-08-19 05:11:10 UTC
Distribution/Version: ubuntu

Load an xcf that has lots of layers (though I'm not sure if that's important).
Copy something, perhaps one of the layers. Paste it, and leave it as a floating
layer.

Select the move tool.
Doubleclick on the floating layer. (Which happens to me when I try to move the
layer and my finger slips on the mouse button, causing an accidental second click.)

GIMP either crashes, or hangs (including hanging X). I see a hang when I run
gimp from the cmdline and doubleclick; I see a crash when I run from the
windowmanager menus and click-drag-slip-secondclick.

If I get to a console and attach gdb to it, I get:

[ ... ]
  • #12 g_on_error_query
    from /usr/lib/libglib-2.0.so.0
  • #13 gimp_eek
    at errors.c line 160
  • #14 gimp_fatal_error
    at errors.c line 118
  • #15 gimp_sigfatal_handler
    at main.c line 551
  • #16 <signal handler called>
  • #17 gimp_draw_tool_draw_boundary
    at gimpdrawtool.c line 1316
  • #18 gimp_edit_selection_tool_draw
    at gimpeditselectiontool.c line 783
  • #19 gimp_draw_tool_draw
    at gimpdrawtool.c line 315
  • #20 gimp_edit_selection_tool_start
    at gimpeditselectiontool.c line 466
  • #21 gimp_move_tool_button_press
    at gimpmovetool.c line 341
  • #22 gimp_tool_button_press
    at gimptool.c line 380
  • #23 gimp_display_shell_canvas_tool_events
    at gimpdisplayshell-callbacks.c line 728
  • #24 _gtk_marshal_BOOLEAN__BOXED
    from /usr/lib/libgtk-x11-2.0.so.0

Comment 1 Akkana Peck 2005-08-19 17:06:35 UTC
Notice draw_tool=0x0, bound_segs=0x0 even though n_bound_segs=4 in #17. It's
trying to loop over that null bound_segs.

But if draw_tool == 0x0, why does the g_return_if_fail (GIMP_IS_DRAW_TOOL
(draw_tool) at the beginning of the function not protect it?

I don't actually understand why the GIMP_IS_DRAW_TOOL check fails (I even tried
a check for draw_tool == 0 at the beginning of the function, and that's failing
too, so maybe it's somehow getting zeroed later?) but I can see why the other
check isn't working: it's backward. Maybe the clause used to be an if and wasn't
reversed when it was changed to g_return_if_fail.

I changed it to two separate checks:
  g_return_if_fail (n_bound_segs > 0);
  g_return_if_fail (bound_segs != NULL);
and I no longer see the crash/hang.
Comment 2 Akkana Peck 2005-08-20 04:01:42 UTC
Fix checked in.
Comment 3 Michael Natterer 2005-08-20 11:10:14 UTC
Reopening because the patch just fixed the resulting crash, the
actual bug is still there and probably hides somewhere in boundary.c
Comment 4 Michael Natterer 2005-08-20 12:23:02 UTC
Fixed in CVS:

2005-08-20  Michael Natterer  <mitch@gimp.org>

	* app/base/boundary.c (sort_boundary): look at the passed "ns"
	variable instead of at the global "num_segs" one to figure if the
	passed array of BoundSegs is empty. Fixes bug #313922 at its root.
Comment 5 Michael Natterer 2005-08-20 12:36:11 UTC
For the records:

2005-08-20  Michael Natterer  <mitch@gimp.org>

	* app/base/boundary.c: moved the entire internal state of boundary
	creation and simplification from <eek>global variables</eek> to a
	new "Boundary" struct that needs to be newly allocated for each
	boundary. Yes this allocates and frees memory more often than
	before but the old code was simply one big eek.