Bug 455203

Summary: Crash while using the color sampler tool
Product: [Applications] krita Reporter: gimmemycomms
Component: Color SelectorsAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: dimula73, halla
Priority: NOR    
Version: 5.0.6   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Usage log for session(s) ended by color selector bug induced crash

Description gimmemycomms 2022-06-13 08:29:18 UTC
Created attachment 149657 [details]
Usage log for session(s) ended by color selector bug induced crash

SUMMARY
Using the color sampler tool will occasionally cause the program to momentarily freeze before shutting down.

***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Open document
2. Use Color Sampler to select color

OBSERVED RESULT
Program freezes for a few seconds, then closes, losing any unsaved work in the process. Message in usage log before crash:
SAFE ASSERT (krita): "!isFromTimer || !m_isEmitting" in file C:\Packaging\workspace\Krita_Release_Windows64_Build\krita\libs\global\kis_signal_compressor.cpp, line 165
================================================================================

EXPECTED RESULT
A color to be selected and added to the palette. 

SOFTWARE/OS VERSIONS
Windows: 10
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
The error occurs infrequently, probably less than 1% of times the tool is used, but often enough to be a daily occurrence, multiple times per day in fact (in a 6 hour drawing session I can expect 3-4 crashes on an average day). Anecdotally it seems more likely to occur if the program has been open without being used for a longer period of time, but can also happen shortly after the program has been opened. This bug has been consistent across numerous versions of the program, at the very least in both versions 4 and 5.
Comment 1 Halla Rempt 2022-06-13 08:45:18 UTC
Could you also attach the kritacrash.log file?
Comment 2 gimmemycomms 2022-06-13 09:00:12 UTC
download link to the crash log as it exceed 4 mb
https://mega.nz/file/dJoVwArC#lmUWxMdoNFw2NujqwAba2nx4BDxrsIzB7E2YHmuQcmU
Comment 3 gimmemycomms 2022-06-13 09:01:55 UTC
I added a comment with a download link, since it was too big to upload, here it is again. https://mega.nz/file/dJoVwArC#lmUWxMdoNFw2NujqwAba2nx4BDxrsIzB7E2YHmuQcmU

Thanks!




Sent with Proton Mail secure email.
------- Original Message -------
On Monday, June 13th, 2022 at 3:45 AM, Halla Rempt <bugzilla_noreply@kde.org> wrote:


> https://bugs.kde.org/show_bug.cgi?id=455203
>
> Halla Rempt halla@valdyas.org changed:
>
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |halla@valdyas.org
> Status|REPORTED |NEEDSINFO
> Resolution|--- |WAITINGFORINFO
>
> --- Comment #1 from Halla Rempt halla@valdyas.org ---
>
> Could you also attach the kritacrash.log file?
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 4 Bug Janitor Service 2022-06-14 04:35:28 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 5 Halla Rempt 2022-06-14 06:50:38 UTC
This is the relevant backtrace:


krita.exe caused an Access Violation at location 00007FFC19D3164F in module libkritacommand.dll Reading from location FFFFFFFFFFFFFFFF.

AddrPC           Params
00007FFC19D3164F 00000000132AAA00 000000000F1BFDA0 000000005184FB10  libkritacommand.dll!0x164f KUndo2Command::actionText+0xf
00007FFC19D319FF 01D6492054215D49 0000000000000001 0000000020DC8410  libkritacommand.dll!0x19ff KUndo2QStack::undoText+0x5f
00007FFC19D31B2F 000000000F1BFE70 000000006FD084C2 000000000000000E  libkritacommand.dll!0x1b2f KUndo2QStack::setIndex+0xbf
00007FFC19D34412 0000000000000000 000000005184FB10 000000005172C810  libkritacommand.dll!0x4412 KUndo2QStack::push+0x282
00007FFBB5346DCB 000000000CD37381 0000000000000000 0000000000000000  libkritaimage.dll!0x116dcb KisStrokeStrategyUndoCommandBased::finishStrokeCallback+0x10b
00007FFBB5518FC4 0000000000000010 000000001CD95850 0000000051AAF8A0  libkritaimage.dll!0x2e8fc4 KisUpdateJobItem::run+0x94
00007FFBAF308610 0000000051A9DDC0 0000000051AAF800 0000000000000000  Qt5Core.dll!0x28610 QThreadPool::tryStart+0x520
00007FFBAF30162F 0000000000000000 0000000000000000 0000000000000000  Qt5Core.dll!0x2162f QThread::qt_metacall+0x69f
00007FFC1FD37BD4 0000000000000000 0000000000000000 0000000000000000  KERNEL32.DLL!0x17bd4 BaseThreadInitThunk+0x14
00007FFC2136CE51 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!0x6ce51 RtlUserThreadStart+0x21

Since we fixed some issues in the undo stack for the upcoming Krita 5.1, there's a fair chance you won't experience this issue when using the nightly builds (though those might have other problems).
Comment 6 gimmemycomms 2022-06-14 07:32:07 UTC
Awesome, thanks for the very quick replies on this bug report!




Sent with Proton Mail secure email.
------- Original Message -------
On Tuesday, June 14th, 2022 at 1:50 AM, Halla Rempt <bugzilla_noreply@kde.org> wrote:


> https://bugs.kde.org/show_bug.cgi?id=455203
>
> --- Comment #5 from Halla Rempt halla@valdyas.org ---
>
> This is the relevant backtrace:
>
>
> krita.exe caused an Access Violation at location 00007FFC19D3164F in module
> libkritacommand.dll Reading from location FFFFFFFFFFFFFFFF.
>
> AddrPC Params
> 00007FFC19D3164F 00000000132AAA00 000000000F1BFDA0 000000005184FB10
> libkritacommand.dll!0x164f KUndo2Command::actionText+0xf
> 00007FFC19D319FF 01D6492054215D49 0000000000000001 0000000020DC8410
> libkritacommand.dll!0x19ff KUndo2QStack::undoText+0x5f
> 00007FFC19D31B2F 000000000F1BFE70 000000006FD084C2 000000000000000E
> libkritacommand.dll!0x1b2f KUndo2QStack::setIndex+0xbf
> 00007FFC19D34412 0000000000000000 000000005184FB10 000000005172C810
> libkritacommand.dll!0x4412 KUndo2QStack::push+0x282
> 00007FFBB5346DCB 000000000CD37381 0000000000000000 0000000000000000
> libkritaimage.dll!0x116dcb
> KisStrokeStrategyUndoCommandBased::finishStrokeCallback+0x10b
> 00007FFBB5518FC4 0000000000000010 000000001CD95850 0000000051AAF8A0
> libkritaimage.dll!0x2e8fc4 KisUpdateJobItem::run+0x94
> 00007FFBAF308610 0000000051A9DDC0 0000000051AAF800 0000000000000000
> Qt5Core.dll!0x28610 QThreadPool::tryStart+0x520
> 00007FFBAF30162F 0000000000000000 0000000000000000 0000000000000000
> Qt5Core.dll!0x2162f QThread::qt_metacall+0x69f
> 00007FFC1FD37BD4 0000000000000000 0000000000000000 0000000000000000
> KERNEL32.DLL!0x17bd4 BaseThreadInitThunk+0x14
> 00007FFC2136CE51 0000000000000000 0000000000000000 0000000000000000
> ntdll.dll!0x6ce51 RtlUserThreadStart+0x21
>
> Since we fixed some issues in the undo stack for the upcoming Krita 5.1,
> there's a fair chance you won't experience this issue when using the nightly
> builds (though those might have other problems).
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 7 Dmitry Kazakov 2022-07-13 08:18:24 UTC
It looks liek the related backtrace is this one: the timer event handler was somehow entered recursively

Error occurred on Monday, June 13, 2022 at 02:54:20.

krita.exe caused an Access Violation at location 00007FFA0FFEC4D1 in module Qt5Core.dll Reading from location FFFFFFFFFFFFFFFF.

AddrPC           Params
00007FFA0FFEC4D1 000000005B3883F0 000000000298DE60 0000000002596870  Qt5Core.dll!0x21c4d1 QObject::~QObject+0x311
00007FFA0FFF094E 000000005B3883F0 0000000000000000 000000000000000F  Qt5Core.dll!0x22094e QTimer::~QTimer+0x12e
00007FFA0FFF0742 000000000036D000 0000000000000000 0000000000030000  Qt5Core.dll!0x220742 QTimer::timeout+0xf2
00007FFA0FFE5F3B 00000000005FFB80 0000000000000000 000000005B3883F0  Qt5Core.dll!0x215f3b QObject::event+0x7b
00007FFA0EC97C5C 0000415701000000 0000000000030000 0000000000000001  Qt5Widgets.dll!0x7c5c QApplicationPrivate::notify_helper+0x9c
00007FFA0EC9EBBE 00000000005FBD18 00007FFA0FFE5F3B 0000000000000000  Qt5Widgets.dll!0xebbe QApplication::notify+0x31e
00007FFA10779A8F 000000005B388DB0 00007FFA0FFC3369 0000000000000401  libkritaui.dll!0x389a8f KisApplication::notify+0x10f
00007FFA0FFB9CD8 0000000000000000 000000000000002A 0000000002A5E140  Qt5Core.dll!0x1e9cd8 QCoreApplication::sendEvent+0x1a8
00007FFA100141F4 0000000000000001 00007FFA0FFC3369 000000000036D000  Qt5Core.dll!0x2441f4 QEventDispatcherWin32Private::sendTimerEvent+0xd4
00007FFA10014AC8 00000000005FFB80 0000000000000000 0000000002A5E140  Qt5Core.dll!0x244ac8 QEventDispatcherWin32::event+0xf8
00007FFA0EC97C5C 00007FFA0E46E6D8 0000000000000000 0000000000000000  Qt5Widgets.dll!0x7c5c QApplicationPrivate::notify_helper+0x9c
00007FFA0EC9EBBE 000000006AA16CA0 00007FFA0E46D248 0000000000000806  Qt5Widgets.dll!0xebbe QApplication::notify+0x31e
00007FFA10779A8F 0000000107DF4A90 00007FFA9E8947B1 00000002001B0000  libkritaui.dll!0x389a8f KisApplication::notify+0x10f
00007FFA0FFB9658 00000000005FC1E8 0000002F00000058 00007FFA9C1C1404  Qt5Core.dll!0x1e9658 QCoreApplication::notifyInternal2+0x198
00007FFA0FFBFC89 0000000001254E30 0000000000000000 0000000000000000  Qt5Core.dll!0x1efc89 QCoreApplicationPrivate::sendPostedEvents+0x199
000000006A8FFD6E 0000000000000401 0000000000211334 000000000036D000  qwindows.dll!0x7fd6e qt_plugin_instance+0x2a3e
00007FFA1001472A 0000000000000000 0000000000000001 0000000000000001  Qt5Core.dll!0x24472a QEventDispatcherWin32Private::sendTimerEvent+0x60a
00007FFA9DD8E858 0000000002A259A0 00007FFA10014250 0000000000211334  USER32.dll!0xe858 UserCallWinProcCheckWow+0x2f8
00007FFA9DD8E299 00007FFA10014250 00000000005FC650 0000000000000000  USER32.dll!0xe299 DispatchMessageWorker+0x249
00007FFA10013BCB 0000000002A5E140 0000000000000024 0000000002927E00  Qt5Core.dll!0x243bcb QEventDispatcherWin32::processEvents+0x5cb
000000006A8FFD55 0000000000000080 0000000000000014 0000000062B90BE0  qwindows.dll!0x7fd55 qt_plugin_instance+0x2a25
00007FFA0FFB7E7F 0000000002A0B700 000000000C477C30 000000004C23D090  Qt5Core.dll!0x1e7e7f QEventLoop::exec+0x13f
00007FFA0FFC10F7 00007FFA0FE799A0 00007FFA81A61D30 0000000000000008  Qt5Core.dll!0x1f10f7 QCoreApplication::exec+0x77
00007FFA112F547D 0000000000000001 00000000025968D0 0000000140007970  krita.dll!0x547d krita_main+0x25cd
00000001400013C7 0000000000000000 0000000000000000 0000000000000000  krita.exe!0x13c7 __tmainCRTStartup+0x247
00000001400014CB 0000000000000000 0000000000000000 0000000000000000  krita.exe!0x14cb WinMainCRTStartup+0x1b
00007FFA9DCD7034 0000000000000000 0000000000000000 0000000000000000  KERNEL32.DLL!0x17034 BaseThreadInitThunk+0x14
00007FFA9E8C2651 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!0x52651 RtlUserThreadStart+0x21
Comment 8 Dmitry Kazakov 2022-07-13 08:19:38 UTC
Hi, gimmemycomms!

Do you remember, did you use "Color Picking Tool" or just used Ctrl+click gesture of the normal brush tool?
Comment 9 Bug Janitor Service 2022-07-14 13:23:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1519
Comment 10 gimmemycomms 2022-07-15 19:26:51 UTC
I use the eyedropper tool which I have a hotkey for.



Sent with Proton Mail secure email.

------- Original Message -------
On Wednesday, July 13th, 2022 at 3:19 AM, Dmitry Kazakov <bugzilla_noreply@kde.org> wrote:


> https://bugs.kde.org/show_bug.cgi?id=455203
>
> --- Comment #8 from Dmitry Kazakov dimula73@gmail.com ---
>
> Hi, gimmemycomms!
>
> Do you remember, did you use "Color Picking Tool" or just used Ctrl+click
> gesture of the normal brush tool?
>
> --
> You are receiving this mail because:
> You reported the bug.
Comment 11 Dmitry Kazakov 2022-07-19 11:14:06 UTC
Git commit 13bd14e1caae48c361e77af54f75f35a2dfb4406 by Dmitry Kazakov.
Committed on 19/07/2022 at 11:04.
Pushed by dkazakov into branch 'master'.

Extract async color picking action into a seperate class

It will let us reuse this extracted class in the real color
picking tool.

M  +1    -0    libs/ui/CMakeLists.txt
A  +279  -0    libs/ui/tool/KisAsyncColorSamplerHelper.cpp     [License: GPL(v2.0+)]
A  +57   -0    libs/ui/tool/KisAsyncColorSamplerHelper.h     [License: GPL(v2.0+)]
M  +37   -217  libs/ui/tool/kis_tool_paint.cc
M  +6    -44   libs/ui/tool/kis_tool_paint.h

https://invent.kde.org/graphics/krita/commit/13bd14e1caae48c361e77af54f75f35a2dfb4406
Comment 12 Dmitry Kazakov 2022-07-19 11:14:15 UTC
Git commit a34a628ec8481859b09a912933d2988242d04aae by Dmitry Kazakov.
Committed on 19/07/2022 at 11:04.
Pushed by dkazakov into branch 'master'.

Fix updates of the palettes widget when color picker updates the color

M  +1    -0    libs/widgets/KisPaletteModel.cpp

https://invent.kde.org/graphics/krita/commit/a34a628ec8481859b09a912933d2988242d04aae
Comment 13 Dmitry Kazakov 2022-07-19 11:14:23 UTC
Git commit 18b8af672db9d604233859e0b99d1fc0963ecd42 by Dmitry Kazakov.
Committed on 19/07/2022 at 11:04.
Pushed by dkazakov into branch 'master'.

Rename variables in KisAsyncColorSamplerHelper

The variables had a "colorPreview" prefix to be distinguishible
amond the other members of KisToolPaint. Now it is not needed
anymore.

M  +54   -51   libs/ui/tool/KisAsyncColorSamplerHelper.cpp

https://invent.kde.org/graphics/krita/commit/18b8af672db9d604233859e0b99d1fc0963ecd42
Comment 14 Dmitry Kazakov 2022-07-19 11:14:31 UTC
Git commit fc2a348b506ff4a109fb6de0d6594748e5163342 by Dmitry Kazakov.
Committed on 19/07/2022 at 11:04.
Pushed by dkazakov into branch 'master'.

Refactor KisToolColorSampler to reuse the strokes code from the ctrl-picking

Now the tool reuses KisAsyncColorSamplerHelper, which makes it
asynchronous.

M  +40   -7    libs/ui/tool/KisAsyncColorSamplerHelper.cpp
M  +8    -1    libs/ui/tool/KisAsyncColorSamplerHelper.h
M  +4    -1    libs/ui/tool/kis_tool_paint.cc
M  +18   -12   libs/ui/tool/strokes/kis_color_sampler_stroke_strategy.cpp
M  +13   -1    libs/ui/tool/strokes/kis_color_sampler_stroke_strategy.h
M  +103  -230  plugins/tools/basictools/kis_tool_colorsampler.cc
M  +9    -21   plugins/tools/basictools/kis_tool_colorsampler.h

https://invent.kde.org/graphics/krita/commit/fc2a348b506ff4a109fb6de0d6594748e5163342
Comment 15 Dmitry Kazakov 2022-07-19 11:15:06 UTC
Git commit f2c271759bf7318779adde85eefad27006c9f25e by Dmitry Kazakov.
Committed on 19/07/2022 at 11:14.
Pushed by dkazakov into branch 'krita/5.1'.

Extract async color picking action into a seperate class

It will let us reuse this extracted class in the real color
picking tool.

M  +1    -0    libs/ui/CMakeLists.txt
A  +279  -0    libs/ui/tool/KisAsyncColorSamplerHelper.cpp     [License: GPL(v2.0+)]
A  +57   -0    libs/ui/tool/KisAsyncColorSamplerHelper.h     [License: GPL(v2.0+)]
M  +37   -217  libs/ui/tool/kis_tool_paint.cc
M  +6    -44   libs/ui/tool/kis_tool_paint.h

https://invent.kde.org/graphics/krita/commit/f2c271759bf7318779adde85eefad27006c9f25e
Comment 16 Dmitry Kazakov 2022-07-19 11:15:15 UTC
Git commit b54292ff256c22c8f134e5a3cbf3441adc6eddab by Dmitry Kazakov.
Committed on 19/07/2022 at 11:14.
Pushed by dkazakov into branch 'krita/5.1'.

Rename variables in KisAsyncColorSamplerHelper

The variables had a "colorPreview" prefix to be distinguishible
amond the other members of KisToolPaint. Now it is not needed
anymore.

M  +54   -51   libs/ui/tool/KisAsyncColorSamplerHelper.cpp

https://invent.kde.org/graphics/krita/commit/b54292ff256c22c8f134e5a3cbf3441adc6eddab
Comment 17 Dmitry Kazakov 2022-07-19 11:15:23 UTC
Git commit c910e97fc55a67b3359285be3a577dc47566a141 by Dmitry Kazakov.
Committed on 19/07/2022 at 11:14.
Pushed by dkazakov into branch 'krita/5.1'.

Refactor KisToolColorSampler to reuse the strokes code from the ctrl-picking

Now the tool reuses KisAsyncColorSamplerHelper, which makes it
asynchronous.

M  +40   -7    libs/ui/tool/KisAsyncColorSamplerHelper.cpp
M  +8    -1    libs/ui/tool/KisAsyncColorSamplerHelper.h
M  +4    -1    libs/ui/tool/kis_tool_paint.cc
M  +18   -12   libs/ui/tool/strokes/kis_color_sampler_stroke_strategy.cpp
M  +13   -1    libs/ui/tool/strokes/kis_color_sampler_stroke_strategy.h
M  +103  -230  plugins/tools/basictools/kis_tool_colorsampler.cc
M  +9    -21   plugins/tools/basictools/kis_tool_colorsampler.h

https://invent.kde.org/graphics/krita/commit/c910e97fc55a67b3359285be3a577dc47566a141
Comment 18 Dmitry Kazakov 2022-07-19 11:15:31 UTC
Git commit 0b4d28400e5b53b41efdc1f8e84b047a59bf0a9b by Dmitry Kazakov.
Committed on 19/07/2022 at 11:14.
Pushed by dkazakov into branch 'krita/5.1'.

Fix updates of the palettes widget when color picker updates the color

M  +1    -0    libs/widgets/KisPaletteModel.cpp

https://invent.kde.org/graphics/krita/commit/0b4d28400e5b53b41efdc1f8e84b047a59bf0a9b