Bug 434646 - Krita crashes on macos randomly
Summary: Krita crashes on macos randomly
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Shortcuts and Canvas Input Settings (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Other
: NOR crash
Target Milestone: ---
Assignee: vanyossi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-20 01:23 UTC by vanyossi
Modified: 2021-05-17 07:16 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vanyossi 2021-03-20 01:23:29 UTC
I open this bug to investigate some random crashes.

This first stack trace seem to suggest it could be related to my custom code for persistent macos global shortcuts

error: libkritawidgets.17.0.0.dylib debug map object file '/Volumes/Osiris/programs/krita-master/kisbuild/libs/widgets/CMakeFiles/kritawidgets.dir/kritawidgets_autogen/mocs_compilation.cpp.o' has changed (actual time is 2021-03-19 18:58:14.000000000, debug map time is 2021-03-19 15:53:14.000000000) since this executable was linked, file will be ignored
error: libkritawidgets.17.0.0.dylib debug map object file '/Volumes/Osiris/programs/krita-master/kisbuild/libs/widgets/CMakeFiles/kritawidgets.dir/KoAspectButton.cpp.o' has changed (actual time is 2021-03-19 18:58:08.000000000, debug map time is 2021-03-15 12:55:05.000000000) since this executable was linked, file will be ignored
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
  * frame #0: 0x00000001035855b4 libkritaflake.17.0.0.dylib`KoToolProxy::priv(this=0x0000000000000000) at KoToolProxy.cpp:478:12 [opt]
    frame #1: 0x00000001011b9a25 libkritaui.17.0.0.dylib`KisToolProxy::activateToolAction(this=0x0000000000000000, action=Primary) at kis_tool_proxy.cpp:220:83 [opt]
    frame #2: 0x0000000101504eca libkritaui.17.0.0.dylib`KisToolInvocationAction::activate(this=0x000000011465f7e0, shortcut=<unavailable>) at kis_tool_invocation_action.cpp:143:28 [opt]
    frame #3: 0x0000000101511c57 libkritaui.17.0.0.dylib`KisShortcutMatcher::tryActivateReadyShortcut(this=0x000000011465f3e0) at kis_shortcut_matcher.cpp:670:38 [opt]
    frame #4: 0x0000000101513848 libkritaui.17.0.0.dylib`KisShortcutMatcher::recoveryModifiersWithoutFocus(this=0x000000011465f3e0, keys=0x00007ffeefbff020) at kis_shortcut_matcher.cpp:481:9 [opt]
    frame #5: 0x0000000101660ace libkritaui.17.0.0.dylib`invocation function for block in activateLocalMonitor(.block_descriptor=<unavailable>, event=0x000000010fb24a00) at kis_extended_modifiers_mapper_osx.mm:106:25 [opt]
    frame #6: 0x00007fff35924982 AppKit`_NSSendEventToObservers + 323
    frame #7: 0x00007fff35923446 AppKit`-[NSApplication(NSEvent) sendEvent:] + 82
    frame #8: 0x000000010b40527a libqcocoa.dylib`___lldb_unnamed_symbol749$$libqcocoa.dylib + 74
    frame #9: 0x00007fff357705bf AppKit`-[NSApplication run] + 707
    frame #10: 0x000000010b401bf8 libqcocoa.dylib`___lldb_unnamed_symbol674$$libqcocoa.dylib + 2648
    frame #11: 0x0000000105bea6bf QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
    frame #12: 0x0000000105bef5c2 QtCore`QCoreApplication::exec() + 130
    frame #13: 0x0000000100010c01 krita`main(argc=<unavailable>, argv=0x00007ffeefbff750) at main.cc:663:17 [opt]
    frame #14: 0x00007fff725f6cc9 libdyld.dylib`start + 1
  thread #7, name = 'OGL Profiler'
    frame #0: 0x00007fff72737dfa libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x00007fff72738170 libsystem_kernel.dylib`mach_msg + 60
    frame #2: 0x00007fff43021c49 OpenGL`glcDebugListener + 299
    frame #3: 0x00007fff727fb109 libsystem_pthread.dylib`_pthread_start + 148
    frame #4: 0x00007fff727f6b8b libsystem_pthread.dylib`thread_start + 15
  thread #8, name = 'com.apple.CFSocket.private'
    frame #0: 0x00007fff727400fe libsystem_kernel.dylib`__select + 10
    frame #1: 0x00007fff38538c53 CoreFoundation`__CFSocketManager + 641
    frame #2: 0x00007fff727fb109 libsystem_pthread.dylib`_pthread_start + 148
    frame #3: 0x00007fff727f6b8b libsystem_pthread.dylib`thread_start + 15
  thread #9, name = 'com.apple.NSEventThread'
    frame #0: 0x00007fff72737dfa libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x00007fff72738170 libsystem_kernel.dylib`mach_msg + 60
    frame #2: 0x00007fff3850fef5 CoreFoundation`__CFRunLoopServiceMachPort + 247
    frame #3: 0x00007fff3850e9c2 CoreFoundation`__CFRunLoopRun + 1319
    frame #4: 0x00007fff3850de3e CoreFoundation`CFRunLoopRunSpecific + 462
    frame #5: 0x00007fff35921954 AppKit`_NSEventThread + 132
    frame #6: 0x00007fff727fb109 libsystem_pthread.dylib`_pthread_start + 148
    frame #7: 0x00007fff727f6b8b libsystem_pthread.dylib`thread_start + 15
  thread #13, name = 'Qt bearer thread'
    frame #0: 0x00007fff7273e3d6 libsystem_kernel.dylib`poll + 10
    frame #1: 0x0000000105c437f0 QtCore`qt_safe_poll(pollfd*, unsigned int, timespec const*) + 480
    frame #2: 0x0000000105c44eb3 QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 899
    frame #3: 0x0000000105bea6bf QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
    frame #4: 0x0000000105a2c09c QtCore`QThread::exec() + 140
    frame #5: 0x0000000105a2cf53 QtCore`___lldb_unnamed_symbol228$$QtCore + 323
    frame #6: 0x00007fff727fb109 libsystem_pthread.dylib`_pthread_start + 148
    frame #7: 0x00007fff727f6b8b libsystem_pthread.dylib`thread_start + 15
  thread #14, name = 'KisTileDataPooler'
    frame #0: 0x00007fff7273a882 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff727fb425 libsystem_pthread.dylib`_pthread_cond_wait + 698
    frame #2: 0x0000000105a3523b QtCore`___lldb_unnamed_symbol285$$QtCore + 59
    frame #3: 0x0000000105a351d4 QtCore`QWaitCondition::wait(QMutex*, QDeadlineTimer) + 100
    frame #4: 0x0000000105a3176f QtCore`QSemaphore::acquire(int) + 79
    frame #5: 0x0000000102a6d0ed libkritaimage.17.0.0.dylib`KisTileDataPooler::run() [inlined] KisTileDataPooler::waitForWork(this=0x0000000114ade9c0) at kis_tile_data_pooler.cc:152:21 [opt]
    frame #6: 0x0000000102a6d09c libkritaimage.17.0.0.dylib`KisTileDataPooler::run(this=0x0000000114ade9c0) at kis_tile_data_pooler.cc:174 [opt]
    frame #7: 0x0000000105a2cf53 QtCore`___lldb_unnamed_symbol228$$QtCore + 323
    frame #8: 0x00007fff727fb109 libsystem_pthread.dylib`_pthread_start + 148
    frame #9: 0x00007fff727f6b8b libsystem_pthread.dylib`thread_start + 15
  thread #15, name = 'KisTileDataSwapper'
    frame #0: 0x00007fff7273a882 libsystem_kernel.dylib`__psynch_cvwait + 10
    frame #1: 0x00007fff727fb425 libsystem_pthread.dylib`_pthread_cond_wait + 698
    frame #2: 0x0000000105a3523b QtCore`___lldb_unnamed_symbol285$$QtCore + 59
    frame #3: 0x0000000105a351d4 QtCore`QWaitCondition::wait(QMutex*, QDeadlineTimer) + 100
    frame #4: 0x0000000105a3193e QtCore`QSemaphore::tryAcquire(int, int) + 142
    frame #5: 0x0000000102a86ddf libkritaimage.17.0.0.dylib`KisTileDataSwapper::run() [inlined] KisTileDataSwapper::waitForWork(this=0x0000000114adea00) at kis_tile_data_swapper.cpp:74:20 [opt]
    frame #6: 0x0000000102a86dc9 libkritaimage.17.0.0.dylib`KisTileDataSwapper::run(this=0x0000000114adea00) at kis_tile_data_swapper.cpp:80 [opt]
    frame #7: 0x0000000105a2cf53 QtCore`___lldb_unnamed_symbol228$$QtCore + 323
    frame #8: 0x00007fff727fb109 libsystem_pthread.dylib`_pthread_start + 148
    frame #9: 0x00007fff727f6b8b libsystem_pthread.dylib`thread_start + 15
  thread #16, name = 'QNetworkAccessManager thread'
    frame #0: 0x00007fff7273e3d6 libsystem_kernel.dylib`poll + 10
    frame #1: 0x0000000105c43680 QtCore`qt_safe_poll(pollfd*, unsigned int, timespec const*) + 112
    frame #2: 0x0000000105c44eb3 QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 899
    frame #3: 0x0000000105bea6bf QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
    frame #4: 0x0000000105a2c09c QtCore`QThread::exec() + 140
    frame #5: 0x0000000105a2cf53 QtCore`___lldb_unnamed_symbol228$$QtCore + 323
    frame #6: 0x00007fff727fb109 libsystem_pthread.dylib`_pthread_start + 148
    frame #7: 0x00007fff727f6b8b libsystem_pthread.dylib`thread_start + 15
  thread #18, name = 'QNetworkAccessManager thread'
    frame #0: 0x00007fff7273e3d6 libsystem_kernel.dylib`poll + 10
    frame #1: 0x0000000105c43680 QtCore`qt_safe_poll(pollfd*, unsigned int, timespec const*) + 112
    frame #2: 0x0000000105c44eb3 QtCore`QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 899
    frame #3: 0x0000000105bea6bf QtCore`QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
    frame #4: 0x0000000105a2c09c QtCore`QThread::exec() + 140
    frame #5: 0x0000000105a2cf53 QtCore`___lldb_unnamed_symbol228$$QtCore + 323
    frame #6: 0x00007fff727fb109 libsystem_pthread.dylib`_pthread_start + 148
    frame #7: 0x00007fff727f6b8b libsystem_pthread.dylib`thread_start + 15
  thread #19
    frame #0: 0x00007fff727394ce libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff727f7aa1 libsystem_pthread.dylib`_pthread_wqthread + 390
    frame #2: 0x00007fff727f6b77 libsystem_pthread.dylib`start_wqthread + 15
  thread #20
    frame #0: 0x00007fff727f6b68 libsystem_pthread.dylib`start_wqthread
  thread #21
    frame #0: 0x00007fff727394ce libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff727f7aa1 libsystem_pthread.dylib`_pthread_wqthread + 390
    frame #2: 0x00007fff727f6b77 libsystem_pthread.dylib`start_wqthread + 15
Comment 1 Halla Rempt 2021-03-20 07:23:17 UTC
Looks like KoToolProxy is a null pointer?

libkritaui.17.0.0.dylib`KisToolProxy::activateToolAction(this=0x0000000000000000, action=Primary) at kis_tool_proxy.cpp:220:83 [opt]
Comment 2 vanyossi 2021-03-21 02:40:51 UTC
Im assigning myself again as it was removed by last editor
Comment 3 Halla Rempt 2021-03-21 07:46:50 UTC
I have asked Justin Zobel once again to stop messing with Krita's bugs.
Comment 4 Justin Zobel 2021-03-21 07:58:48 UTC
(In reply to Halla Rempt from comment #3)
> I have asked Justin Zobel once again to stop messing with Krita's bugs.

My apologies for trying to help with bug triaging.
Comment 5 Halla Rempt 2021-03-21 09:14:57 UTC
Don't be so passive-agressive Justin. 

We've discussed this before and I have explained to you why mass-changing bug statuses, assignees or adding "please test this again" messages is not useful at all. I know you mean well, but you are not helping: you are making work for us. Three people have spent time on this: Ivan to fix the status, Tiar to explain to Ivan who this Justin is that made work for him, and me to explain to you once again that you're doing the wrong thing.

Get to know a project, read the bug reports, understand them, get to know the people in a project and only then you can really help out.

Honestly, it's completely beyond me why you even thought you needed to remove the assignee here. It's a bug that was filed yesterday, by the person who is investigating the issue...

(Quite apart from the fact that you set the assignee to null without changing the ASSIGNED status, which is wrong.)
Comment 6 vanyossi 2021-03-25 02:34:11 UTC
i have been using krita with a small patch to kis_tool_proxy.cpp:220:83 it checks the pointer to be valid before calling KisToolProxy. So far no crashes
Comment 7 vanyossi 2021-04-01 16:44:39 UTC
Closing as the random bug during my painting sessions is always KoToolproxy. 

pushed a quick fix for it.

https://invent.kde.org/graphics/krita/-/commit/e97414d541bd9de8e080cf4cee0ce3d2c9ab1973
Comment 8 vanyossi 2021-04-10 01:26:30 UTC
found the reason to this bug:

We started listening to shortcuts outside of krita's focus, however if the user presses a key combination that happens to be a shortcut outside the action will be triggered even with krita out of focus or with focus but no active document  whic means KisToolProxy::private is null causing the crash.
Comment 9 vanyossi 2021-04-23 16:22:20 UTC
Git commit 88106a143b3d0349e272e258f2936a3ac09078b6 by Ivan Yossi.
Committed on 23/04/2021 at 14:52.
Pushed by ivany into branch 'master'.

Fix random crashes on macOS

Also it should fix cursor getting stuck after switching to other apps using cmd+tab and returning to krita using mouse click.

M  +2    -8    libs/ui/input/kis_extended_modifiers_mapper.cpp
M  +0    -1    libs/ui/input/kis_extended_modifiers_mapper.h
M  +1    -7    libs/ui/input/kis_extended_modifiers_mapper_osx.h
M  +5    -30   libs/ui/input/kis_extended_modifiers_mapper_osx.mm
M  +0    -2    libs/ui/input/kis_input_manager.cpp

https://invent.kde.org/graphics/krita/commit/88106a143b3d0349e272e258f2936a3ac09078b6
Comment 10 vanyossi 2021-05-17 07:16:07 UTC
Git commit 1c4172249a831fb3895d8852f8a3389a40f143c1 by Ivan Yossi.
Committed on 17/05/2021 at 07:15.
Pushed by ivany into branch 'krita/4.3'.

Fix random crashes on macOS

Also it should fix cursor getting stuck after switching to other apps using cmd+tab and returning to krita using mouse click.

M  +2    -8    libs/ui/input/kis_extended_modifiers_mapper.cpp
M  +0    -1    libs/ui/input/kis_extended_modifiers_mapper.h
M  +1    -7    libs/ui/input/kis_extended_modifiers_mapper_osx.h
M  +5    -30   libs/ui/input/kis_extended_modifiers_mapper_osx.mm
M  +0    -2    libs/ui/input/kis_input_manager.cpp

https://invent.kde.org/graphics/krita/commit/1c4172249a831fb3895d8852f8a3389a40f143c1