Using Brush or Line Tools Sometimes Delete Part of The Layer in a Square/Rectangle Pattern

Hi, all!

Could you please try to remember, did you have Instant Preview mode on when you reproduced this issue?

I have encountered the bug with Instant Preview both on and off.

HI, everyone!

Could you make one more test, does the bug still happen if you switch the brush into ā€œBuild Upā€ mode (in the brush editor under ā€œpainting modeā€ option)?

1 Like

Hi, everyone!

Could you please test this package if the issue is still there?

Windows x64: krita-5.2.0-prealpha-line-issue-dk1.zip — ЯнГекс.Диск

I have fixed a bug in the line tool that looks different from the one you report, but it might still be related…

3 Likes

For the record:
I have not produced this bug in buildup mode.
I have produced this bug in the above package.

This video is my entire Krita session from startup to the bug occuring, using my own build with a bunch of custom logging (which may not be very helpful, or very readable with the video compression). I don’t know why Krita claims to be on git c3b830b, since I definitely pulled fac1d60b and recompiled…
In this case it took about a dozen strokes to reproduce. Sometimes it takes much longer, and one time it happened on the first stroke.

Here’s the part of the log for the stroke where the bug occurred; what I’ve noticed is if parentOriginal != currentLeaf->projection() in KisAsyncMerger::setupProjection, KisPaintDevice::clear is called, which clears the tiles. My question then is why the two values become different.

~100 lines of custom logging
== KisToolLineHelper::start ==
KisToolLineHelper::repaintLine
KisToolLineHelper::repaintLine fin
KisPaintDevice::KisPaintDevice  KisPaintDevice(0x1872cbaf920) colorSpace "RGB/Alpha (8-bit integer/channel)" ("RGBA","U8" ) name ""
KisMementoManager::setDefaultTileData
KisMementoManager::getMemento(
WARN: m_index.isEmpty() in KisMementoManager::getMemento
KisMementoManager::commit(
    m_currentMemento 0x0
    m_index.numTiles 0
)KisMementoManager::commit
)KisMementoManager::getMemento 0x1873db40770
"26 Oct 2022 13:51:43 -0500"
Executing merge job QRect(27,3 50x110) on thread 0x1c04
running: merge  KisPaintLayer(0x1870a9fa3c0, name = "Background") QRect(27,3 50x110)
thread 0x1c04 KisAsyncMerger::startMerge
thread 0x1c04 KisAsyncMerger::setupProjection currentLeaf: QSharedPointer(0x1872a6db280) rect QRect(27,3 50x110) useTempProjection false
  device: KisPaintDevice(0x1870012e210)
KisPainter::copyAreaOptimizedImpl
on thread 0x1c04 KisAsyncMerger::resetProjection
KisToolLineHelper::repaintLine
KisToolFreehandHelper::cancelPaint
KisToolLineHelper::repaintLine fin
== KisToolLineHelper::end ==
KisToolFreehandHelper::endPaint()
KisToolLineHelper::clearPoints
KisToolLineHelper::end fin
KisMementoManager::purgeHistory
KisMementoManager::commit(
    m_currentMemento 0x1873db40770
    m_index.numTiles 4
    tile:  1 1
    tile:  0 1
    tile:  0 0
    tile:  1 0
    m_revisions.append hItem.memento 0x1873db40770
)KisMementoManager::commit
KisPaintDevice::KisPaintDevice  KisPaintDevice(0x18700340580) colorSpace "RGB/Alpha (8-bit integer/channel)" ("RGBA","U8" ) name ""
"26 Oct 2022 13:51:43 -0500"
Executing merge job QRect(0,0 128x128) on thread 0x609c
running: merge  KisPaintLayer(0x1870a9fa3c0, name = "Background") QRect(0,0 128x128)
thread 0x609c KisAsyncMerger::startMerge
KisMementoManager::setDefaultTileData
thread 0x609c KisAsyncMerger::setupProjection currentLeaf: QSharedPointer(0x1872a6db280) rect QRect(0,0 128x128) useTempProjection false
KisMementoManager::getMemento(
  parentOriginal != KisPaintDevice(0x1872d400730) currentLeaf->projection KisPaintDevice(0x1870012e210)
WARN: m_index.isEmpty() in KisMementoManager::getMemento
on thread 0x609c KisPaintDevice(0x1872d400730) clear QRect(0,0 128x128)
KisMementoManager::commit(
KisPaintDevice::clear QRect(0,0 128x128)
    m_currentMemento 0x0
KisPaintDeviceStrategy::clear
    m_index.numTiles 0
KisTiledDataManager::clear QRect(192,64 128x128) 0x1872ca34f90
)KisMementoManager::commit
KisTiledDataManager::duplicatePixel
)KisMementoManager::getMemento 0x187093fdcf0
KisPainter::copyAreaOptimizedImpl
on thread 0x609c KisAsyncMerger::resetProjection
KisMementoManager::purgeHistory
KisMementoManager::commit(
    m_currentMemento 0x187093fdcf0
    m_index.numTiles 4
    tile:  1 1
    tile:  0 1
    tile:  0 0
    tile:  1 0
"26 Oct 2022 13:51:43 -0500"
    m_revisions.append hItem.memento 0x187093fdcf0
Executing merge job QRect(27,3 50x110) on thread 0x1c04
)KisMementoManager::commit
running: merge  KisPaintLayer(0x1870a9fa3c0, name = "Background") QRect(27,3 50x110)
thread 0x1c04 KisAsyncMerger::startMerge
thread 0x1c04 KisAsyncMerger::setupProjection currentLeaf: QSharedPointer(0x1872a6db280) rect QRect(27,3 50x110) useTempProjection false
  device: KisPaintDevice(0x1870012e210)
KisPainter::copyAreaOptimizedImpl
on thread 0x1c04 KisAsyncMerger::resetProjection
KisMementoManager::getMemento(
KisMementoManager::commit(
    m_currentMemento 0x0
    m_index.numTiles 4
    tile:  3 2
    tile:  4 1
    tile:  4 2
    tile:  3 1
    m_revisions.append hItem.memento 0x0
)KisMementoManager::commit
)KisMementoManager::getMemento 0x1873db396b0
KisMementoManager::currentMemento 0x1873db396b0
KisMementoManager::commit(
    m_currentMemento 0x1873db396b0
    m_index.numTiles 4
    tile:  3 2
    tile:  4 1
    tile:  4 2
    tile:  3 1
    m_revisions.append hItem.memento 0x1873db396b0
)KisMementoManager::commit
----> KUndo2Command::redo ""
----> KUndo2QStack::push "Draw Line"

Hi, @freyalupen!

Could you please check this new package? (or just update master to 6d87f89408cec4)

krita-5.2.0-prealpha-line-issue-dk2.zip — ЯнГекс.Диск

I have fixed a race condition in KisAsyncMerger::setupProjection that you pointed out. Tough I could barely reproduce it (even with custom msleep(10) calls and asserts), so I do need a confirmation that my fix actually fixes the issue :slight_smile:

1 Like

I painted with the line tool for about 10 minutes using the above package and did not encounter the tile erasure bug or the line tool hang bug, so it appears to me that both are fixed!


Dozens of lines and no bugs.

1 Like

@ynr_nohara Can you test the package and see if the bug is still there?

1 Like

@raghukamath
Ok I tried drawing with the Krita 5.2.0 prealpha that is linked in the post above for around 3 hours. I also try to draw in a more manic way, switching between 3 brush in a fast manner. So far I didn’t encounter any pixel bug.

I also turn on the log viewer, and the only concerning things it shows are those yellow warning talking about keyboard modifier. I checked all the list in the log setting. Sorry if it is not of much help. I am not familiar with software debugging on this level.

2 Likes

Hi, @freyalupen and @ynr_nohara!

Thanks a lot for testing! I think we can consider the bug as fixed now! :slight_smile:

6 Likes

Hi

From this topic:

It seems similar problem occurs with Dynamic Brush tool.

Can someone confirm it’s the same case?

Thanks

Grum999

this frequently happens to me when I’m using brushes in just normal painting. I haven’t done any experimentation, but if I find a brush that does this, I put it in a different tag and avoid it, so far