Improve tool behaviour when layer deleted whilst editing
If you delete a layer (delete key) whilst drawing with the gradient/path/freehand/spline/line/rect/elipse/shape tool an error appears. If you do so with the path tool it also crashes the editor. Tools should gracefully handle the current layer being deleted by cleaning up and aborting.
I feel like it shouldn't be possible to delete the layer while you're working on it in the first place. From a UX perspective, it just feels wrong. In what situation would you want to delete the layer while you're drawing on it? Maybe the editor should just ignore a layer delete while a tool is active instead?
Delete applies to the selection, not to the tool. So if you have a layer or layers selected (such as by clicking on it in the layer panel), the Delete key should delete it for consistency. Having to switch to the Select tool isn't ideal, since you might have the Gradient tool active by happenstance but you're just cleaning up random layers in the Layer Tree panel and you want them to be deleted. If you are actively interacting with the tool, like in the middle of dragging a gradient, I think the user is unlikely to ever attempt that and it's sort of their fault for deleting something while in the middle of dragging a gradient or something. I would suggest that, for code simplicity and because it provides consistency to the user in an admittedly weird edge case, we still delete the layer and correctly clean up and abort the tool state. The alternative would mean we need to write special code to not delete layers at certain times when certain tools are in certain states, even though layer deletion is not part of the tool system.
Is this still an issue?