Bug 415794 - Krita crashes when opening a file 3 times without krita already open
Summary: Krita crashes when opening a file 3 times without krita already open
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-02 11:54 UTC by Antti Savolainen
Modified: 2020-01-15 09:43 UTC (History)
2 users (show)

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 Antti Savolainen 2020-01-02 11:54:52 UTC
SUMMARY
Simply opening 3 files before Krita finishes loading, Krita crashes.

STEPS TO REPRODUCE
1. Set your file manager to open files in krita by default
2. Open a file 3 times in a rapid succession

OBSERVED RESULT
Krita crashes

EXPECTED RESULT
Krita should treat the situation the same way as what happens when krita is already open

SOFTWARE/OS VERSIONS
Arch Linux 
KDE Plasma Version: 5.17.4
KDE Frameworks Version: 5.65.0
Qt Version: 5.14

ADDITIONAL INFORMATION
BUILD
krita 4.2.8 (git 16a7bae)

BACKTRACE

Application: krita (krita), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f7dc1ffc800 (LWP 72307))]

Thread 3 (Thread 0x7f7db84da700 (LWP 72315)):
#0  0x00007f7dc4e18479 in g_mutex_lock () from /usr/lib/libglib-2.0.so.0
#1  0x00007f7dc4e66720 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#2  0x00007f7dc4e680c8 in ?? () from /usr/lib/libglib-2.0.so.0
#3  0x00007f7dc4e681f1 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#4  0x00007f7dc7c7acdc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#5  0x00007f7dc7c2139c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#6  0x00007f7dc7a46e62 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#7  0x00007f7dc57dfb28 in ?? () from /usr/lib/libQt5DBus.so.5
#8  0x00007f7dc7a47fd6 in ?? () from /usr/lib/libQt5Core.so.5
#9  0x00007f7dc57af4cf in start_thread () from /usr/lib/libpthread.so.0
#10 0x00007f7dc76b22d3 in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7f7dc0f39700 (LWP 72313)):
#0  0x00007f7dc76a79ef in poll () from /usr/lib/libc.so.6
#1  0x00007f7dc4cc5630 in ?? () from /usr/lib/libxcb.so.1
#2  0x00007f7dc4cc72db in xcb_wait_for_event () from /usr/lib/libxcb.so.1
#3  0x00007f7dc18dba01 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#4  0x00007f7dc7a47fd6 in ?? () from /usr/lib/libQt5Core.so.5
#5  0x00007f7dc57af4cf in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007f7dc76b22d3 in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7f7dc1ffc800 (LWP 72307)):
[KCrash Handler]
#6  QPointer<KisMainWindow>::data (this=0x0) at /usr/include/qt/QtCore/qpointer.h:82
#7  QPointer<KisMainWindow>::operator KisMainWindow* (this=0x0) at /usr/include/qt/QtCore/qpointer.h:83
#8  KisApplication::remoteArguments (this=0x7ffd176951e0, message=..., socket=<optimized out>) at /usr/src/debug/krita-4.2.8.2/libs/ui/KisApplication.cpp:672
#9  0x00007f7dc9e4d90b in KisApplication::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /usr/include/qt/QtCore/qrefcount.h:60
#10 0x00007f7dc7c58370 in ?? () from /usr/lib/libQt5Core.so.5
#11 0x00007f7dc9e45335 in QtSingleApplication::messageReceived (this=<optimized out>, _t1=..., _t2=<optimized out>) at /usr/src/debug/build/libs/ui/kritaui_autogen/OYVIXWUKGM/moc_qtsingleapplication.cpp:170
#12 0x00007f7dc7c58370 in ?? () from /usr/lib/libQt5Core.so.5
#13 0x00007f7dc9e452d5 in QtLocalPeer::messageReceived (this=this@entry=0x564794f29620, _t1=..., _t2=<optimized out>, _t2@entry=0x56479566c7d0) at /usr/src/debug/build/libs/ui/kritaui_autogen/OYVIXWUKGM/moc_qtlocalpeer.cpp:142
#14 0x00007f7dca26ab80 in QtLocalPeer::receiveConnection (this=0x564794f29620) at /usr/src/debug/krita-4.2.8.2/libs/ui/qtsingleapplication/qtlocalpeer.cpp:179
#15 0x00007f7dc9e4b266 in QtLocalPeer::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /usr/src/debug/build/libs/ui/kritaui_autogen/OYVIXWUKGM/moc_qtlocalpeer.cpp:83
#16 0x00007f7dc7c58370 in ?? () from /usr/lib/libQt5Core.so.5
#17 0x00007f7dc623c5ae in ?? () from /usr/lib/libQt5Network.so.5
#18 0x00007f7dc7c58370 in ?? () from /usr/lib/libQt5Core.so.5
#19 0x00007f7dc7c5bb82 in QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal) () from /usr/lib/libQt5Core.so.5
#20 0x00007f7dc7c5bed2 in QSocketNotifier::event(QEvent*) () from /usr/lib/libQt5Core.so.5
#21 0x00007f7dc86b9472 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#22 0x00007f7dc86c2c89 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#23 0x00007f7dca1f3f5a in KisApplication::notify (this=<optimized out>, receiver=0x564794cc1660, event=0x7ffd17694d40) at /usr/src/debug/krita-4.2.8.2/libs/ui/KisApplication.cpp:653
#24 0x00007f7dc7c22832 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#25 0x00007f7dc7c7b8c6 in ?? () from /usr/lib/libQt5Core.so.5
#26 0x00007f7dc4e6639e in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#27 0x00007f7dc4e681b1 in ?? () from /usr/lib/libglib-2.0.so.0
#28 0x00007f7dc4e681f1 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#29 0x00007f7dc7c7ad33 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#30 0x00007f7dca1f60bd in KisApplication::start (this=this@entry=0x7ffd176951e0, args=...) at /usr/include/qt/QtCore/qflags.h:118
#31 0x0000564793448bdb in main (argc=<optimized out>, argv=0x7ffd17695348) at /usr/src/debug/krita-4.2.8.2/krita/main.cc:531
[Inferior 1 (process 72307) detached]
Comment 1 Antti Savolainen 2020-01-02 11:56:10 UTC
Forgot to add a video link https://youtu.be/ctUWHaYgrqU
Comment 2 Rebecca Breu 2020-01-02 15:43:12 UTC
I can confirm this with the 4.2.8 appimage. I can reproduce it in command line by typing 

krita-4.2.8-x86_64.appimage & krita-4.2.8-x86_64.appimage

Results in a segfault. I guess it would also happen if you put an icon to Krita on the desktop, and maybe more often on a slow system where Krita takes a while to start up and you get impatient and click again...
Comment 3 Halla Rempt 2020-01-03 13:42:50 UTC
Git commit 4c715c4c9470b9a454413cd9002ace514abc7ee1 by Boudewijn Rempt.
Committed on 03/01/2020 at 13:41.
Pushed by rempt into branch 'master'.

Don't crash if remoteArguments is called when there isn't a mainwindow

This isn't perfect: if you're fast enough you can still start a
couple of Krita processes even if application process sharing is
enabled. That can't be helped, though.

M  +22   -15   libs/ui/KisApplication.cpp
M  +1    -0    libs/ui/KisApplication.h

https://invent.kde.org/kde/krita/commit/4c715c4c9470b9a454413cd9002ace514abc7ee1
Comment 4 Halla Rempt 2020-01-08 13:56:23 UTC
Git commit 8db82515ce132c1190597aae1aa1f80f841dd5af by Boudewijn Rempt.
Committed on 08/01/2020 at 13:33.
Pushed by rempt into branch 'krita/4.2'.

Don't crash if remoteArguments is called when there isn't a mainwindow

This isn't perfect: if you're fast enough you can still start a
couple of Krita processes even if application process sharing is
enabled. That can't be helped, though.

M  +22   -15   libs/ui/KisApplication.cpp
M  +1    -0    libs/ui/KisApplication.h

https://invent.kde.org/kde/krita/commit/8db82515ce132c1190597aae1aa1f80f841dd5af
Comment 5 vanyossi 2020-01-14 15:21:19 UTC
Reopening because of regression: bug 416202
Comment 6 Halla Rempt 2020-01-15 09:43:45 UTC
Git commit b12857f6997f938625161c6e04a3e9e3f10fc0f6 by Boudewijn Rempt.
Committed on 15/01/2020 at 09:42.
Pushed by rempt into branch 'master'.

Check whether there are any mainwindows before taking the first
Related: bug 416202

M  +1    -1    libs/ui/KisApplication.cpp

https://invent.kde.org/kde/krita/commit/b12857f6997f938625161c6e04a3e9e3f10fc0f6