Bug 427137

Summary: krita crashes unexpectedly on closing normally
Product: [Applications] krita Reporter: aiena.makehuman
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: tamtamy.tymona
Priority: NOR    
Version First Reported In: 4.3.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Krita crash stacktrace

Description aiena.makehuman 2020-09-30 02:03:48 UTC
Created attachment 132018 [details]
Krita crash stacktrace

SUMMARY
Krita often crashes on normal close after saving files. This is not a major issue because all files save OK. No real data is lost but closing the application normally should not create a crash.

STEPS TO REPRODUCE
1. Work on Krita with some painting for some time
2. Save the file
3. Close Krita

OBSERVED RESULT
On close kcrash reports that Krita closed unexpectedly.

EXPECTED RESULT
Krita should close normally

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 20.04
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Kernel Version: 5.4.0-48-generic
OS Type: 64-bit
Processors: 8 × Intel® Core™ i5-8250U CPU @ 1.60GHz
Memory: 7.6 GiB of RAM

ADDITIONAL INFORMATION

I have attached the a stack trace.

Below is terminal output from krita launch till crash.

aiena@aiena-Inspiron-3576:~/kritadev/install/bin$ ./krita
KoColor debug runtime checks are active.
QObject::startTimer: Timers cannot have negative intervals
/home/aiena/kritadev/install/lib/x86_64-linux-gnu/krita-python-libs/krita added to PYTHONPATH
qrc:/touchstrip.qml:3:1: module "org.krita.sketch.components" is not installed
qrc:/touchstrip.qml:2:1: module "org.krita.sketch" is not installed
qrc:/touchstrip.qml:3:1: module "org.krita.sketch.components" is not installed
qrc:/touchstrip.qml:2:1: module "org.krita.sketch" is not installed
QLayout: Attempting to add QLayout "" to QWidget "", which already has a layout
QBasicTimer::start: QBasicTimer can only be used with threads started with QThread
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = krita path = /home/aiena/kritadev/install/bin pid = 6589
KCrash: Arguments: /home/aiena/kritadev/install/bin/krita 
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
Comment 1 Tiar 2021-04-22 14:13:33 UTC
Git commit e7bd37c699944a78cde620b52118d254a254b708 by Agata Cacko.
Committed on 22/04/2021 at 14:13.
Pushed by tymond into branch 'master'.

Fix crash on exit by setting styleSheet only on QTabBar

Before this commit, Krita would crash on exit on Qt 5.12.8
with segfault in the destructor for the Python plugin
widgets. It turned out that this crash was introduced in
8a7bae681a1f992, and the reason turned out to be
a method setStyleSheet() with non-empty string.
Setting empty stylesheet later (on closing) didn't make a difference.
However setting the stylesheet on just the widget
that needs it (QTabBar that keeps the document tabs)
fixes/prevents the crash.

Alternative fix would be to find the widget for the Python plugin
and explicitely set empty stylesheet after every non-empty
stylesheet set for the whole application. It wasn't tested,
but in case more widgets need non-empty stylesheet, it sounds
like it should work.
Related: bug 420612

M  +10   -6    libs/ui/KisMainWindow.cpp

https://invent.kde.org/graphics/krita/commit/e7bd37c699944a78cde620b52118d254a254b708
Comment 2 Tiar 2021-04-22 14:21:50 UTC
Can you please check if e7bd37c699944a fixes the crash on startup for you? I have the same Qt version and I was getting the same backtrace, so I hope it did fix/prevent it.