Bug 404179 - Rectangle tool hangs or asserts when using thin brushes
Summary: Rectangle tool hangs or asserts when using thin brushes
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Unclassified
Component: Tools (show other bugs)
Version: 4.1.7
Platform: Microsoft Windows Microsoft Windows
: NOR crash
Target Milestone: ---
Assignee: Tiar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-10 16:25 UTC by shenyang64
Modified: 2019-03-26 18:48 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshots of hangup (371.71 KB, image/png)
2019-02-10 16:25 UTC, shenyang64
Details

Note You need to log in before you can comment on or make changes to this bug.
Description shenyang64 2019-02-10 16:25:58 UTC
Created attachment 117965 [details]
Screenshots of hangup

SUMMARY
When I try to draw a rectangle using the rectangle using a thin brush, the rectangle never finishes drawing and it prevents me from drawing more shapes and saving. I'm forced to close Krita without saving. After the editor window closes, Krita is still running in the background and taking up a lot of memory.

STEPS TO REPRODUCE
1. Select brush "Basic-1"
2. Set brush size to 0.5
3. Select the rectangle tool
4. Make sure the layer is a paint layer
5. Try to draw a rectangle

OBSERVED RESULT
The editor is still responsive but saving and drawing more shapes are blocked by waiting for the rectangle to be drawn which never happens

EXPECTED RESULT
A rectangle with a thin outline appears

SOFTWARE/OS VERSIONS
Windows

ADDITIONAL INFORMATION
Comment 1 shenyang64 2019-02-11 02:26:05 UTC
Just wanted to specify it's Windows 10
Comment 2 Halla Rempt 2019-02-11 11:58:42 UTC
Hi,

I can reproduce this issue with the 4.1.7 appimage on Linux. With a build from masterI get an assert:

ASSERT: "w > 0" in file /home/boud/dev/krita/libs/image/tiles3/kis_hline_iterator.cpp, line 31
Comment 3 Dmitry Kazakov 2019-03-13 18:01:58 UTC
I can confirm on Linux with my recent hash table patches :)

(gdb) bt
#0  0x00007fffec3da428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#1  0x00007fffec3dc02a in __GI_abort () at abort.c:89
#2  0x00007fffecd8d1bd in QMessageLogger::fatal(char const*, ...) const () from /home/devel5/rawenv-1/deps/usr/lib/libQt5Core.so.5
#3  0x00007fffee1a86f5 in kis_assert_common (assertion=assertion@entry=0x7fffef26cdc0 "hash != KeyTraits::NullHash", file=file@entry=0x7fffef26cd00 "/home/devel5/rawenv-1/krita/libs/image/3rdparty/lock_free_map/leapfrog.h", line=line@entry=161, throwException=throwException@entry=false, isIgnorable=isIgnorable@entry=false) at /home/devel5/rawenv-1/krita/libs/global/kis_assert.cpp:90
#4  0x00007fffee1a8ffe in kis_assert_recoverable (assertion=assertion@entry=0x7fffef26cdc0 "hash != KeyTraits::NullHash", file=file@entry=0x7fffef26cd00 "/home/devel5/rawenv-1/krita/libs/image/3rdparty/lock_free_map/leapfrog.h", line=line@entry=161) at /home/devel5/rawenv-1/krita/libs/global/kis_assert.cpp:103
#5  0x00007fffeec24f67 in Leapfrog<ConcurrentMap<unsigned int, KisTile*, DefaultKeyTraits<unsigned int>, DefaultValueTraits<KisTile*> > >::find (table=0x61d000aa4680, hash=0) at /home/devel5/rawenv-1/krita/libs/image/3rdparty/lock_free_map/leapfrog.h:161
#6  ConcurrentMap<unsigned int, KisTile*, DefaultKeyTraits<unsigned int>, DefaultValueTraits<KisTile*> >::get (this=0x60b0003a2810, key=<optimized out>) at /home/devel5/rawenv-1/krita/libs/image/3rdparty/lock_free_map/concurrent_map.h:264
#7  0x00007fffeec2e12e in KisTileHashTableTraits2<KisTile>::getTileLazy (this=<optimized out>, col=<optimized out>, row=<optimized out>, newTile=<optimized out>) at /home/devel5/rawenv-1/krita/libs/image/tiles3/kis_tile_hash_table2.h:311
#8  0x00007fffeec51754 in KisTiledDataManager::getTile (writable=<optimized out>, row=-33554432, col=-33554432, this=0x610000121140) at /home/devel5/rawenv-1/krita/libs/image/tiles3/kis_tiled_data_manager.h:120
#9  KisTiledDataManager::getTilesPair (oldTile=0x6060007b4780, tile=0x6060007b4778, writable=<optimized out>, row=-33554432, col=-33554432, this=0x610000121140) at /home/devel5/rawenv-1/krita/libs/image/tiles3/kis_tiled_data_manager.h:107
#10 KisHLineIterator2::fetchTileDataForCache (this=this@entry=0x60f00003eb60, kti=..., col=col@entry=-33554432, row=row@entry=-33554432) at /home/devel5/rawenv-1/krita/libs/image/tiles3/kis_hline_iterator.cpp:206
#11 0x00007fffeec54ef1 in KisHLineIterator2::KisHLineIterator2 (this=0x60f00003eb60, dataManager=<optimized out>, x=<optimized out>, y=<optimized out>, w=<optimized out>, offsetX=<optimized out>, offsetY=0, writable=true, competionListener=0x6100001210f0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /home/devel5/rawenv-1/krita/libs/image/tiles3/kis_hline_iterator.cpp:63
#12 0x00007fffef077f70 in KisPaintDevice::Private::KisPaintDeviceStrategy::createHLineIteratorNG (this=this@entry=0x6030027f0880, dataManager=0x610000121140, x=x@entry=-2147483648, y=y@entry=-2147483648, w=w@entry=0, offsetX=0, offsetY=0) at /home/devel5/rawenv-1/krita/libs/image/kis_paint_device_strategies.h:92
#13 0x00007fffef04f0f8 in KisPaintDevice::createHLineIteratorNG (this=this@entry=0x60400221e190, x=-2147483648, y=y@entry=-2147483648, w=0) at /home/devel5/rawenv-1/krita/libs/image/kis_paint_device.cc:1753
#14 0x00007fffeecaaa5f in DevicePolicy::createIterator (rect=..., this=<optimized out>) at /home/devel5/rawenv-1/krita/libs/image/kis_sequential_iterator.h:40
#15 WritableIteratorPolicy<DevicePolicy>::WritableIteratorPolicy (rect=..., source=..., this=<synthetic pointer>) at /home/devel5/rawenv-1/krita/libs/image/kis_sequential_iterator.h:83
#16 KisSequentialIteratorBase<WritableIteratorPolicy<DevicePolicy>, DevicePolicy, NoProgressPolicy>::KisSequentialIteratorBase (progressPolicy=..., rect=..., source=..., this=<optimized out>) at /home/devel5/rawenv-1/krita/libs/image/kis_sequential_iterator.h:200
#17 KisMarkerPainter::fillHalfBrushDiff (this=this@entry=0x7fff7b5833f0, p1=..., p2=..., p3=..., center=..., radius=radius@entry=0.25) at /home/devel5/rawenv-1/krita/libs/image/kis_marker_painter.cpp:66
#18 0x00007fffeecac708 in KisMarkerPainter::fillCirclesDiff (this=this@entry=0x7fff7b5833f0, c1=..., r1=<optimized out>, c2=..., r2=r2@entry=0.25) at /home/devel5/rawenv-1/krita/libs/image/kis_marker_painter.cpp:139
#19 0x00007fffcac77993 in KisRoundMarkerOp::paintAt (this=0x61200074b6c0, info=...) at /home/devel5/rawenv-1/krita/plugins/paintops/roundmarker/kis_roundmarkerop.cpp:105
#20 0x00007fffeecc3f31 in KisPaintInformation::paintAt<KisPaintOp> (distanceInfo=0x7fff7b5839c0, op=..., this=0x7fff7b583640) at /home/devel5/rawenv-1/krita/libs/image/brushengine/kis_paint_information.h:117
#21 KisPaintOpUtils::paintLine<KisPaintOp> (op=..., pi1=..., pi2=..., currentDistance=0x7fff7b5839c0, fanCornersEnabled=<optimized out>, fanCornersStep=<optimized out>) at /home/devel5/rawenv-1/krita/libs/image/brushengine/kis_paintop_utils.h:96
Comment 4 Tiar 2019-03-26 18:48:30 UTC
Git commit d7542a79f7f3028227147f4cfba18928694e2961 by Agata Cacko.
Committed on 26/03/2019 at 18:48.
Pushed by tymond into branch 'master'.

Fix Sequential Iterator assert on invalid rectangles

Summary:
Before Quick Brush engine (roundmarker) was crashing
because Sequential Iterator throwed out asserts
when the rectangle was not "empty" according to Qt
but  still not valid (for example has intmin value on
width or height). This commit fixes that behaviour by
providing additional checks.
Commit includes also benchmarks for roundmarker.

Test Plan:
- benchmarks included in the commit
- painting with Quick Brush (i.e. b) Basic-1)
with size <1 px

Reviewers: dkazakov, #krita

Reviewed By: dkazakov, #krita

Subscribers: rempt

Tags: #krita

Differential Revision: https://phabricator.kde.org/D19881

A  +-    --    benchmarks/data/roundmarker05px.kpp
A  +-    --    benchmarks/data/roundmarker40px.kpp
M  +106  -0    benchmarks/kis_stroke_benchmark.cpp
M  +15   -0    benchmarks/kis_stroke_benchmark.h
M  +4    -3    libs/global/kis_algebra_2d.cpp
M  +28   -2    libs/image/kis_marker_painter.cpp
M  +20   -0    libs/image/kis_marker_painter.h

https://commits.kde.org/krita/d7542a79f7f3028227147f4cfba18928694e2961