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 795877 - Eraser not working on a pasted layer (floating selection)
Eraser not working on a pasted layer (floating selection)
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
2.10.0
Other All
: Normal normal
: 2.10
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2018-05-07 11:17 UTC by Paweł Szeptyński
Modified: 2018-05-08 08:41 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Paweł Szeptyński 2018-05-07 11:17:25 UTC
When I paste (Ctrl+C and Ctrl+V) previously copied selection\layer\image (in all of those cases) as a pasted layer (floating selection), before anchoring it I can't edit it with Eraser tool. It happens always, both in case of new images and opened images.

At first I thought that it is a matter of e.g. lacking alpha-channel, however add/remove alpha is disabled for floating selection both in the top menu Layer->Transparency and in the menu displayed after right-mouse-click on layer list.

During testing some other cases, a message "Fatal Error: unhandled exception" was displayed and GIMP crashed. I've tried it again - it seems that this error appears when two (or possibly more) images are opened and in both of them a layer is pasted (not necessarily the same) and not yet anchored. After closing one of those images GIMP always crashes.


REMARK: I've installed Separate+ which does not run properly with GIMP 2.10.
Comment 1 Michael Schumacher 2018-05-07 13:31:55 UTC
There should be no crash, of course, but not being editable is one of the shortcomings of floating selections, and a reason for why we want them gone.

We should focus on the crash here.
Comment 2 Paweł Szeptyński 2018-05-07 13:46:09 UTC
(In reply to Michael Schumacher from comment #1)
> There should be no crash, of course, but not being editable is one of the
> shortcomings of floating selections, and a reason for why we want them gone.
> 
> We should focus on the crash here.

They were editable in previous versions of GIMP (e.g. 2.8) and they are still editable with other tools - I've checked brush, gradient, blur, burn, clone, pencil, ink, airbrush, smudge, MyPaintBrush and they all work well. Is it an intentional change? I can't find any information on such a change comparing to 2.8. I'd be grateful for any explanation.
Comment 3 Ell 2018-05-07 21:01:14 UTC
This happens because the floating selection's alpha channel is locked by default (which can be toggled through the layers dialog).  This was still the case in 2.8, however, 2.8 indeed allowed using the eraser tool on a layer with a locked alpha channel.  This is probably not a behavior we want to reintroduce, though.  

Instead, let's address this by showing an appropriate warning, indicating that the alpha channel is locked, when trying to use the eraser tool, or any other paint tool that would have no effect:

commit 1910ff8b1ab6f19b57a8f2ab86b2c977576995f3
Author: Ell <ell_se@yahoo.com>
Date:   Mon May 7 16:40:27 2018 -0400

    app: warn when alpha-only painting has no effect
    
    Add a GimpPaintTool::is_alpha_only() virtual function, which
    subclasses can override to indicate whether painting only affects
    the alpha channel (assuming FALSE by default).  Override the
    function in Gimp{PaintBrush,Ink,Clone}Tool, returning TRUE when the
    current paint mode only affects the alpha (as per
    gimp_layer_mode_is_alpha_only(); see the previous commit,) and in
    GimpEraserTool, returning TRUE when the target drawable has an
    alpha channel.
    
    When the function returns TRUE, and the target drawable doesn't
    have an alpha channel, or the alpha channel is locked, show a BAD
    cursor modifier, and raise an appropriate warning when attempting
    to paint.

 app/tools/gimpclonetool.c      | 20 ++++++++++++++++++++
 app/tools/gimperasertool.c     | 39 ++++++++++++++++++++++++++-------------
 app/tools/gimpinktool.c        | 32 +++++++++++++++++++++++++-------
 app/tools/gimppaintbrushtool.c | 20 ++++++++++++++++++++
 app/tools/gimppainttool.c      | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
 app/tools/gimppainttool.h      | 19 +++++++++++--------
 6 files changed, 149 insertions(+), 30 deletions(-)
Comment 4 Ell 2018-05-07 22:01:14 UTC
I completely missed the crash part (which is unrelated, and which I can't reproduce).  Can you please open a new bug for that?
Comment 5 Paweł Szeptyński 2018-05-08 08:41:44 UTC
(In reply to Ell from comment #4)
> I completely missed the crash part (which is unrelated, and which I can't
> reproduce).  Can you please open a new bug for that?

Thank you! The crash event is now decribed here:
https://bugzilla.gnome.org/show_bug.cgi?id=795909