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 795909 - Multiple images opened with floating selection - closing one of them crashes GIMP
Multiple images opened with floating selection - closing one of them crashes ...
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
2.10.0
Other Windows
: Normal normal
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2018-05-08 08:40 UTC by Paweł Szeptyński
Modified: 2018-05-08 14:25 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Paweł Szeptyński 2018-05-08 08:40:18 UTC
The crash may be caused in a following way:
1) Open two new images (Ctrl+N) - single non-transparent layer is enough.
2) Paste anything into both pictures (image in the clipboard or anything what was already drawn in the picture). Currently we have two images opened and in both of them a floating selection (pasted layer) is present.
4) Edit the floating selection in one of the images with any tool, then close this image (I always discarded changes)
5) GIMP crashes.
Comment 1 Ell 2018-05-08 14:25:56 UTC
Thanks.  Fixed in master:

commit bc09c718186de42795b7cd9562766c5dc01cbe5e
Author: Ell <ell_se@yahoo.com>
Date:   Tue May 8 10:11:25 2018 -0400

    Bug 795909 - Multiple images opened with floating selection ...
    
    ... closing one of them crashes GIMP
    
    GimpSymmetry keeps a strong reference to the drawable passed to
    gimp_symmetry_set_origin() until the next call to set_origin(), or
    until it's destroyed.  This can unnecessarily extend the lifetime
    of the drawable.  In particular, it can extend the lifetime of a
    floating selection past the destruction of the image mask, during
    image destruction, which results in a NULL mask pointer in
    gimp_layer_invalidate_boundary(), called when detaching the
    floating selection as part of its destructor.
    
    Add gimp_symmetry_clear_origin(), which clears the origin set using
    gimp_symmetry_set_origin(), dropping the reference to the drawable,
    and call it in gimp_paint_core_paint() after painting.  This avoids
    extending the lifetime of the drawable, and fixes the bug.

 app/core/gimpsymmetry.c   | 26 ++++++++++++++++++++------
 app/core/gimpsymmetry.h   |  1 +
 app/paint/gimppaintcore.c |  1 +
 3 files changed, 22 insertions(+), 6 deletions(-)