GNOME Bugzilla – Bug 795877
Eraser not working on a pasted layer (floating selection)
Last modified: 2018-05-08 08:41:44 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.
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.
(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.
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(-)
I completely missed the crash part (which is unrelated, and which I can't reproduce). Can you please open a new bug for that?
(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