Bug 412530 - Crash when creating a freehand path using an xp-pen tablet
Summary: Crash when creating a freehand path using an xp-pen tablet
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tools/Vector (show other bugs)
Version: 4.2.7
Platform: macOS (DMG) macOS
: NOR crash
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: release_blocker
Depends on:
Blocks:
 
Reported: 2019-10-02 09:47 UTC by Halla Rempt
Modified: 2019-10-09 07:23 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Halla Rempt 2019-10-02 09:47:16 UTC
The crash happens when creating a freehand path using an xp-pen tablet on macOS.

We discussed this on IRC and it probably needs backporting some of tusooa's work on make flake more threadsafe.

Backtrace:


Process:               krita [762]
Path:                  /Applications/krita.app/Contents/MacOS/krita
Identifier:            org.krita
Version:               4.2.7-beta1 (???)
Code Type:             X86-64 (Native)
Parent Process:        bash [616]
Responsible:           krita [762]
User ID:               501

Date/Time:             2019-10-01 15:35:34.988 +0200
OS Version:            Mac OS X 10.13.6 (17G65)
Report Version:        12
Anonymous UUID:        3AA81DC8-10C2-4117-7ABB-DC191CAC9A1E

Sleep/Wake UUID:       B93C8FCE-3CAC-4CA0-BAD1-E1744AC576CB

Time Awake Since Boot: 5700 seconds
Time Since Wake:       3100 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called
*** error for object 0x7febcce16800: pointer being freed was not allocated
 

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib              0x00007fff7db19b66 __pthread_kill + 10
1   libsystem_pthread.dylib             0x00007fff7dce4080 pthread_kill + 333
2   libsystem_c.dylib                   0x00007fff7da751ae abort + 127
3   libsystem_malloc.dylib              0x00007fff7db73822 free + 521
4   libkritaflake.18.dylib              0x000000010b77d416 KoPathShape::outline() const + 1462
5   libkritaflake.18.dylib              0x000000010b7af24b KoShapeManager::shapesAt(QRectF const&, bool, bool) + 443
6   libkritabasicflakes.18.dylib        0x000000011b66fdb1 KoPencilTool::endPointAtPosition(QPointF const&) + 97
7   libkritabasicflakes.18.dylib        0x000000011b6703d9 KoPencilTool::mouseMoveEvent(KoPointerEvent*) + 57
8   kritadefaulttools.so                0x000000011c8e93ad KisDelegatedTool<KisToolShape, __KisToolPencilLocalTool, DeselectShapesActivationPolicy>::mouseMoveEvent(KoPointerEvent*) + 29
9   libkritaflake.18.dylib              0x000000010b7de5bd KoToolProxy::tabletEvent(QTabletEvent*, QPointF const&) + 301
10  libkritaui.18.dylib                 0x0000000109c1ffc8 0x109bfd000 + 143304
11  libkritaui.18.dylib                 0x0000000109f3b657 KisInputManager::Private::handleCompressedTabletEvent(QEvent*) + 615
12  libkritaui.18.dylib                 0x0000000109f376cb KisInputManager::slotCompressedMoveEvent() + 27
13  org.qt-project.QtCore               0x000000010d6b309c QMetaObject::activate(QObject*, int, int, void**) + 3132
14  libkritaglobal.18.dylib             0x000000010bf74c72 KisSignalCompressor::start() + 66
15  libkritaui.18.dylib                 0x0000000109f37490 0x109bfd000 + 3384464
16  libkritaui.18.dylib                 0x0000000109f35b8b KisInputManager::eventFilterImpl(QEvent*) + 811
17  libkritaui.18.dylib                 0x0000000109f356f7 KisInputManager::eventFilter(QObject*, QEvent*) + 103
18  org.qt-project.QtCore               0x000000010d6820f4 QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) + 148
19  org.qt-project.QtWidgets            0x000000010c2e8708 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 248
20  org.qt-project.QtWidgets            0x000000010c2e9e5b QApplication::notify(QObject*, QEvent*) + 1419
21  libkritaui.18.dylib                 0x0000000109fac61a KisApplication::notify(QObject*, QEvent*) + 26
22  org.qt-project.QtCore               0x000000010d681e44 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 212
23  org.qt-project.QtWidgets            0x000000010c345a75 0x10c2d8000 + 449141
24  org.qt-project.QtWidgets            0x000000010c342601 0x10c2d8000 + 435713
25  org.qt-project.QtWidgets            0x000000010c2e871d QApplicationPrivate::notify_helper(QObject*, QEvent*) + 269
26  org.qt-project.QtWidgets            0x000000010c2e9b22 QApplication::notify(QObject*, QEvent*) + 594
27  libkritaui.18.dylib                 0x0000000109fac61a KisApplication::notify(QObject*, QEvent*) + 26
28  org.qt-project.QtCore               0x000000010d681e44 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 212
29  org.qt-project.QtGui                0x000000010ce1cccb QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::TabletEvent*) + 1403
30  org.qt-project.QtGui                0x000000010ce0080b QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 219
31  libqcocoa.dylib                     0x00000001105bc5f0 0x110588000 + 214512
32  libqcocoa.dylib                     0x00000001105bcd50 0x110588000 + 216400
33  com.apple.CoreFoundation            0x00007fff55b07d31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
34  com.apple.CoreFoundation            0x00007fff55bbf60c __CFRunLoopDoSource0 + 108
35  com.apple.CoreFoundation            0x00007fff55aeace0 __CFRunLoopDoSources0 + 208
36  com.apple.CoreFoundation            0x00007fff55aea15d __CFRunLoopRun + 1293
37  com.apple.CoreFoundation            0x00007fff55ae99b7 CFRunLoopRunSpecific + 487
38  com.apple.HIToolbox                 0x00007fff54dc9d96 RunCurrentEventLoopInMode + 286
39  com.apple.HIToolbox                 0x00007fff54dc9a0f ReceiveNextEventCommon + 366
40  com.apple.HIToolbox                 0x00007fff54dc9884 _BlockUntilNextEventMatchingListInModeWithFilter + 64
41  com.apple.AppKit                    0x00007fff5307aa73 _DPSNextEvent + 2085
42  com.apple.AppKit                    0x00007fff53810e34 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
43  com.apple.AppKit                    0x00007fff5306f885 -[NSApplication run] + 764
44  libqcocoa.dylib                     0x00000001105bbccb 0x110588000 + 212171
45  org.qt-project.QtCore               0x000000010d67d50f QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 431
46  org.qt-project.QtCore               0x000000010d682452 QCoreApplication::exec() + 130
47  org.krita                           0x0000000108c6d9df main + 10319
48  libdyld.dylib                       0x00007fff7d9c9015 start + 1
Comment 1 Halla Rempt 2019-10-02 10:09:41 UTC
See also https://forum.kde.org/viewtopic.php?f=139&t=162602
Comment 2 Dmitry Kazakov 2019-10-08 15:30:50 UTC
Git commit d5279a0196bbaa08bb505a0db121a156a9d6d341 by Dmitry Kazakov.
Committed on 08/10/2019 at 15:26.
Pushed by dkazakov into branch 'krita/4.2'.

Remove extra update when creating a new shape

The update is emitted by KoShapeManager itself, so there is no
reason to trigger it manually (it also eases thread-safety concerns,
because after adding the shape to shape manager it is no longer safe
to access it from the worker thread).

M  +0    -5    libs/ui/flake/kis_shape_controller.cpp

https://invent.kde.org/kde/krita/commit/d5279a0196bbaa08bb505a0db121a156a9d6d341
Comment 3 Dmitry Kazakov 2019-10-08 15:30:50 UTC
Git commit d4ee038d34b8a9e3b8fa2e53a09a2bb4da57f576 by Dmitry Kazakov.
Committed on 08/10/2019 at 15:26.
Pushed by dkazakov into branch 'krita/4.2'.

Fix crash when using Pencil Tool with a tablet

The patch basically makes KoPathShape::outline() cont-safe. Q_FOREACH
doesn't support thread-safety, because it relies on copy-on-write.
Every non-const access during Q_FOREACH will casue a detach, which
is not safe in multithreaded environment.

M  +6    -4    libs/flake/KoPathShape.cpp

https://invent.kde.org/kde/krita/commit/d4ee038d34b8a9e3b8fa2e53a09a2bb4da57f576
Comment 4 Dmitry Kazakov 2019-10-08 15:34:09 UTC
Git commit b67fede2997233fc5303022f439ded895c04cedb by Dmitry Kazakov.
Committed on 08/10/2019 at 15:33.
Pushed by dkazakov into branch 'master'.

Remove extra update when creating a new shape

The update is emitted by KoShapeManager itself, so there is no
reason to trigger it manually (it also eases thread-safety concerns,
because after adding the shape to shape manager it is no longer safe
to access it from the worker thread).

M  +0    -5    libs/ui/flake/kis_shape_controller.cpp

https://invent.kde.org/kde/krita/commit/b67fede2997233fc5303022f439ded895c04cedb
Comment 5 Dmitry Kazakov 2019-10-08 15:34:09 UTC
Git commit fb81d715fc99d09c0e6fe72759152fd0261592b8 by Dmitry Kazakov.
Committed on 08/10/2019 at 15:33.
Pushed by dkazakov into branch 'master'.

Fix crash when using Pencil Tool with a tablet

The patch basically makes KoPathShape::outline() cont-safe. Q_FOREACH
doesn't support thread-safety, because it relies on copy-on-write.
Every non-const access during Q_FOREACH will casue a detach, which
is not safe in multithreaded environment.

M  +6    -4    libs/flake/KoPathShape.cpp

https://invent.kde.org/kde/krita/commit/fb81d715fc99d09c0e6fe72759152fd0261592b8
Comment 6 Halla Rempt 2019-10-09 07:23:32 UTC
The user reports that the issue is fixed.