Bug 393851 - If Krita loads with the Eraser as default brush, it paints to black when used
Summary: If Krita loads with the Eraser as default brush, it paints to black when used
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Brush Engine/Shape (other bugs)
Version First Reported In: 4.0.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-04 16:31 UTC by amyspark
Modified: 2018-05-15 19:01 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Video provided by zveryok of the bug (2.56 MB, video/mp4)
2018-05-04 16:31 UTC, amyspark
Details

Note You need to log in before you can comment on or make changes to this bug.
Description amyspark 2018-05-04 16:31:55 UTC
Created attachment 112417 [details]
Video provided by zveryok of the bug

(bug found by zveryok on #pepper&carrot)

If Krita is closed with the Eraser selected, next time Krita is opened and the Eraser is used, it paints with the foreground color until it is *deselected* and the application closed.

Reproduced under Arch Linux (zveryok, attached video) and MacOS Sierra 10.12.6 and Windows 7 x64 (amyspark).
Comment 1 Scott Petrovic 2018-05-10 13:16:08 UTC
Confirmed on my Ubuntu 17.10 box.
Comment 2 Scott Petrovic 2018-05-10 22:05:53 UTC
I started looking at this, but it appears it might be a bit deeper than I thought. The code that loads the preset when the application starts is here

KisViewManager::setCurrentView(KisView *view):409

When this function grabs the last used preset, it grabs the correct name. The code seems to think the composite mode is "normal" and erase mode is set to false which isn't what is saved in the preset. There must be something that hasn't been loaded correctly when this gets called.
Comment 3 amyspark 2018-05-11 15:26:18 UTC
(In reply to Scott Petrovic from comment #2)
> I started looking at this, but it appears it might be a bit deeper than I
> thought. The code that loads the preset when the application starts is here
> 
> KisViewManager::setCurrentView(KisView *view):409
> 
> When this function grabs the last used preset, it grabs the correct name.
> The code seems to think the composite mode is "normal" and erase mode is set
> to false which isn't what is saved in the preset. There must be something
> that hasn't been loaded correctly when this gets called.

Go to KisPaintopBox::setCurrentPaintop(KisPaintOpPresetSP preset) and check preset->settings()->eraserMode(). It (somehow) does not save/load that it has the Eraser enabled.
Comment 4 Dmitry Kazakov 2018-05-12 11:16:40 UTC
The bug sounds weird, because the normal erasers were never expected to have Eraser Mode active, instead they were expected to have a Eraser composite op set...
Comment 5 amyspark 2018-05-15 19:01:34 UTC
Git commit 686e733dd03269bb43a745d7110132f38424f3f0 by L. E. Segovia.
Committed on 15/05/2018 at 18:42.
Pushed by lsegovia into branch 'amyspark/D12832-eraser-fix'.

Fix Eraser not loading upon first launching Krita

This is a mix of:
 - The paintopbox not receiving the change of compositeop.
 - Qt messing up with Krita's highlightable buttons.
 - The paintopbox loading the preset before setCurrentView, which borks
 Qt from emitting the relevant update signals.
Differential Revision: https://phabricator.kde.org/D12832

M  +1    -1    libs/ui/KisViewManager.cpp
M  +6    -0    libs/ui/kis_action_manager.cpp
M  +49   -19   libs/ui/kis_paintop_box.cc

https://commits.kde.org/krita/686e733dd03269bb43a745d7110132f38424f3f0