Bug 374142 - Contiguous selection tool not always works
Summary: Contiguous selection tool not always works
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (other bugs)
Version First Reported In: 3.1.1
Platform: Other Linux
: NOR major
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
: 375174 376777 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-12-25 13:06 UTC by Dmitrii Utkin
Modified: 2017-03-29 11:03 UTC (History)
9 users (show)

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


Attachments
screencast for the problem (1.72 MB, video/ogg)
2016-12-25 13:06 UTC, Dmitrii Utkin
Details
Selection test (557.44 KB, image/png)
2017-02-13 12:03 UTC, Dmitrii Utkin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitrii Utkin 2016-12-25 13:06:59 UTC
Created attachment 102987 [details]
screencast for the problem

Contiguous selection tool not always works. This often occur when you try to perform selection to the lower part of image - it newer works. But if you select region above first, then selection to the lower part of image works..

For details please see screencast attached.

I didn't notified that bug before.

Using appimage. krita version 3.1.1 x64.
Comment 1 Halla Rempt 2016-12-28 09:19:44 UTC
Hi Dmitry,

Is this also reproducible if you use another desktop than Unity? And which version of Ubuntu are you using?
Comment 2 Halla Rempt 2016-12-28 09:21:20 UTC
Never mind... I've seen it happen under Gnome on OpenSUSE now.
Comment 3 Dmitrii Utkin 2016-12-28 10:03:00 UTC
I use Ubuntu 16.04 64bit

This is reproducible under Mac OS X too. But the area where that tool does not work is smaller and located in right bottom corner.
Comment 4 David REVOY 2017-01-08 13:55:56 UTC
I confirm this one also on Manjaro/XFCE + 3.1.1appimage. "Contiguous selection tool" is not alone in this problem, but the easiest to trigger/reproduce the bug. Here is a video when rectangular selection tool get also locked: https://share.kde.org/index.php/s/5ld58LjpExouKCF .In this case no workaround, just restarting Krita and loosing session.
Comment 5 Halla Rempt 2017-01-17 09:40:29 UTC
*** Bug 375174 has been marked as a duplicate of this bug. ***
Comment 6 Raghavendra kamath 2017-02-04 05:54:30 UTC
confirmed on arch linux with latest git version of krita,

This is also a problem in similar color selection tool. selecting similar colors only works if the color is present in the top half

if there are no similar colors in upper part of the image and all the similar colors are in the bottom half , it doesn't select anything, meanwhile if there is a color in top half of the image it selects the color in entire image even if we click on the bottom half, As if it is only sampling from the top half of the image
Comment 7 onetimeisawabird 2017-02-09 20:37:14 UTC
Same problem on Windows even for the newest update 3.1.2

However, continguous selection tool does not work for me at all. I used to use 3.0.1.1 and it was fine, but after updating I can't get the tool to work unless I'm using krita version 3.0
Comment 8 onetimeisawabird 2017-02-09 20:44:23 UTC
(In reply to onetimeisawabird from comment #7)
> Same problem on Windows even for the newest update 3.1.2
> 
> However, continguous selection tool does not work for me at all. I used to
> use 3.0.1.1 and it was fine, but after updating I can't get the tool to work
> unless I'm using krita version 3.0

Also does not work for the testing build 3.1.88
Using a Surface Pro 3
Comment 9 onetimeisawabird 2017-02-09 20:45:49 UTC
(In reply to onetimeisawabird from comment #7)
> Same problem on Windows even for the newest update 3.1.2
> 
> However, continguous selection tool does not work for me at all. I used to
> use 3.0.1.1 and it was fine, but after updating I can't get the tool to work
> unless I'm using krita version 3.0

Also does not work for the testing build 3.1.88
Using a Surface Pro 3
Comment 10 Davide Olianas 2017-02-13 09:39:40 UTC
I think I experience this exact bug and it appears I've found a workaround.

Steps:
* open an image
* click with the contiguous selection tool -> selection doesn't appear
* Choose Select/Reselect -> now the selection appears for the current selection and all the following ones
Comment 11 Dmitrii Utkin 2017-02-13 10:12:30 UTC
(In reply to Davide Olianas from comment #10)
> I think I experience this exact bug and it appears I've found a workaround.
> 
> Steps:
> * open an image
> * click with the contiguous selection tool -> selection doesn't appear
> * Choose Select/Reselect -> now the selection appears for the current
> selection and all the following ones

Nice workaround, pressing Ctrl+Shift+D makes selection visible. But you have to press Ctrl+Shift+D every time whey you had no selection and use Contiguous selection tool.
Comment 12 Davide Olianas 2017-02-13 10:26:19 UTC
(In reply to Dmitry from comment #11)

> But you have to press Ctrl+Shift+D every time whey you had no selection
> and  use Contiguous selection tool.

Obviously it's still a pain in the butt but I hope this helps in finding the bug. 

In the following days I'll try git bisect, hopefully I should find an old version that compiles and doesn't have the bug. In this way developers could understand where the problem is.
Comment 13 Dmitrii Utkin 2017-02-13 11:04:43 UTC
(In reply to Davide Olianas from comment #12)
> Obviously it's still a pain in the butt but I hope this helps in finding the
> bug. 
> 
> In the following days I'll try git bisect, hopefully I should find an old
> version that compiles and doesn't have the bug. In this way developers could
> understand where the problem is.

I checked it just now: for me appimage version 3.0.1.1 does not have this bug, but 3.1.0 have it.
Comment 14 Halla Rempt 2017-02-13 11:55:41 UTC
Yes, please -- a bisect would be super helpful!
Comment 15 Dmitrii Utkin 2017-02-13 12:03:57 UTC
Created attachment 104017 [details]
Selection test

I've done additional test. Contiguous selection tool does not work in area marked yellow. Looks like hyperbola or.. ellipse?
Blue dots are circles filled by selecting with contiguous selection tool and pressing Shift+Backspace (deselect and repeat with next cell).

Also as David said, any selection tools stopped working after tens of clicks.
Comment 16 Davide Olianas 2017-02-13 22:05:22 UTC
Here is the result of git bisect


46b602ce35c920a337a31401f48d75e3c133bd71 is the first bad commit
commit 46b602ce35c920a337a31401f48d75e3c133bd71
Author: Dmitry Kazakov <dimula73@gmail.com>
Date:   Wed Oct 19 15:22:34 2016 +0300

    Crop selection outline correctly when creating a cropped selection

:040000 040000 a96d2a7e81177721f60fdc1975591efeb7cdd6bf aa88065ad768294e93354cc3b3c6f4f4e3f3efa0 M   libs
Comment 17 Halla Rempt 2017-02-14 10:50:00 UTC
Put on the task list for the next release: https://phabricator.kde.org/T5353
Comment 18 wolthera 2017-02-21 21:53:05 UTC
*** Bug 376777 has been marked as a duplicate of this bug. ***
Comment 19 Dmitry Kazakov 2017-03-25 16:51:11 UTC
Git commit 02ac4216a4913fe3e5f69e7281c5f72a6df91c9e by Dmitry Kazakov.
Committed on 25/03/2017 at 16:49.
Pushed by dkazakov into branch 'kazakov/svg-loading'.

Fix resetting the paint device cache on every iterator completion

This bug should have happened one day. We should reset the paint device
cache not only on the creation of the iterator, but also on its
completion.

The actual bug happened because of concurrency, while the stroke was
filling the selection, an delayed updateGUI() in the status bar
requested selection->selectedExactRect(), which effectively updated the
cache with empty rect (which it was at that moment). And when the
iterator completed with the updated seleciton, the cache was already
initialized with wrong (empty) rect.

Now all the iterators notify the paint device about their completion
using a special interface, therefore the problem cannot happen, all
the editing event will be synchronized.

A  +33   -0    libs/image/kis_iterator_complete_listener.h     [License: GPL (v2+)]
M  +6    -2    libs/image/kis_paint_device.cc
M  +31   -8    libs/image/kis_paint_device_data.h
M  +12   -12   libs/image/kis_paint_device_strategies.h
M  +13   -11   libs/image/kis_repeat_iterators_pixel.h
M  +4    -2    libs/image/kis_wrapped_hline_iterator.h
M  +4    -2    libs/image/kis_wrapped_line_iterator_base.h
M  +2    -1    libs/image/kis_wrapped_random_accessor.cpp
M  +1    -0    libs/image/kis_wrapped_random_accessor.h
M  +4    -2    libs/image/kis_wrapped_vline_iterator.h
M  +11   -1    libs/image/tiles3/kis_base_iterator.h
M  +2    -2    libs/image/tiles3/kis_hline_iterator.cpp
M  +1    -1    libs/image/tiles3/kis_hline_iterator.h
M  +7    -2    libs/image/tiles3/kis_random_accessor.cc
M  +3    -1    libs/image/tiles3/kis_random_accessor.h
M  +2    -2    libs/image/tiles3/kis_vline_iterator.cpp
M  +1    -1    libs/image/tiles3/kis_vline_iterator.h

https://commits.kde.org/krita/02ac4216a4913fe3e5f69e7281c5f72a6df91c9e
Comment 20 Dmitry Kazakov 2017-03-29 11:03:15 UTC
Git commit 3a50b43867cb70b10d139c5db8e1217d96217d50 by Dmitry Kazakov.
Committed on 29/03/2017 at 10:03.
Pushed by dkazakov into branch 'krita/3.1'.

Fix resetting the paint device cache on every iterator completion

This bug should have happened one day. We should reset the paint device
cache not only on the creation of the iterator, but also on its
completion.

The actual bug happened because of concurrency, while the stroke was
filling the selection, an delayed updateGUI() in the status bar
requested selection->selectedExactRect(), which effectively updated the
cache with empty rect (which it was at that moment). And when the
iterator completed with the updated seleciton, the cache was already
initialized with wrong (empty) rect.

Now all the iterators notify the paint device about their completion
using a special interface, therefore the problem cannot happen, all
the editing event will be synchronized.

A  +33   -0    libs/image/kis_iterator_complete_listener.h     [License: GPL (v2+)]
M  +6    -2    libs/image/kis_paint_device.cc
M  +31   -8    libs/image/kis_paint_device_data.h
M  +12   -12   libs/image/kis_paint_device_strategies.h
M  +13   -11   libs/image/kis_repeat_iterators_pixel.h
M  +4    -2    libs/image/kis_wrapped_hline_iterator.h
M  +4    -2    libs/image/kis_wrapped_line_iterator_base.h
M  +2    -1    libs/image/kis_wrapped_random_accessor.cpp
M  +1    -0    libs/image/kis_wrapped_random_accessor.h
M  +4    -2    libs/image/kis_wrapped_vline_iterator.h
M  +11   -1    libs/image/tiles3/kis_base_iterator.h
M  +2    -2    libs/image/tiles3/kis_hline_iterator.cpp
M  +1    -1    libs/image/tiles3/kis_hline_iterator.h
M  +7    -2    libs/image/tiles3/kis_random_accessor.cc
M  +3    -1    libs/image/tiles3/kis_random_accessor.h
M  +2    -2    libs/image/tiles3/kis_vline_iterator.cpp
M  +1    -1    libs/image/tiles3/kis_vline_iterator.h

https://commits.kde.org/krita/3a50b43867cb70b10d139c5db8e1217d96217d50