Bug 399709

Summary: Crashes when trying to open any documentation
Product: [Frameworks and Libraries] frameworks-kio Reporter: Heiko Becker <heiko.becker>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal CC: asturm, kdelibs-bugs, mpyne, rdieter
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Heiko Becker 2018-10-12 11:54:03 UTC
I'm pretty sure this started happening with 5.51.0, but I have no 5.50.0 around to test. Any interaction with the help kioslave seems to crash it.


STEPS TO REPRODUCE
1. Press F1 or Help Menu -> foo Handbook or open khelpcenter

OBSERVED RESULT
drkonqi tells me kdeinit5 crashes, khelpcenter only show an error page with "The requested operation could not be completed" "Unexpected Program Termination"

EXPECTED RESULT
Documentation appears

SOFTWARE VERSIONS
KDE Plasma Version: 5.14.0
KDE Frameworks Version: 5.51.0 (from the tarballs available for packagers)
Qt Version: 5.11.2

Backtrace:
Application: kdeinit5 (kdeinit5), signal: Segmentation fault
Using host libthread_db library "/usr/x86_64-pc-linux-gnu/lib/libthread_db.so.1".
[KCrash Handler]
#6  0x00007fb48e8a1e3c in std::__atomic_base<int>::load (__m=std::memory_order_relaxed, this=0x3500740071006e) at /usr/x86_64-pc-linux-gnu/include/c++/8.2.0/bits/atomic_base.h:390
#7  QAtomicOps<int>::load<int> (_q_value=...) at ../../include/QtCore/../../src/corelib/thread/qatomic_cxx11.h:227
#8  QBasicAtomicInteger<int>::load (this=0x3500740071006e) at ../../include/QtCore/../../src/corelib/thread/qbasicatomic.h:103
#9  QtPrivate::RefCount::deref (this=0x3500740071006e) at ../../include/QtCore/../../src/corelib/tools/qrefcount.h:66
#10 QString::operator= (this=0x56011cf86220, other=...) at tools/qstring.cpp:2185
#11 0x00007fb48f3d0cc6 in KCrash::setApplicationFilePath (filePath=...) at /usr/x86_64-pc-linux-gnu/include/qt5/QtCore/qlist.h:115
#12 0x00007fb48f3d17e3 in KCrash::initialize () at /var/tmp/paludis/build/kde-frameworks-kcrash-5.51.0/work/kcrash-5.51.0/src/kcrash.cpp:138
#13 0x00007fb48abf9691 in KIO::SlaveBase::SlaveBase (this=0x7ffc90f74220, protocol=..., pool_socket=..., app_socket=...) at /var/tmp/paludis/build/kde-frameworks-kio-5.51.0/work/kio-5.51.0/src/core/slavebase.cpp:244
#14 0x00007fb48f41cb4f in HelpProtocol::HelpProtocol (this=0x7ffc90f74220, ghelp=<optimized out>, pool=..., app=...) at /var/tmp/paludis/build/kde-frameworks-kio-5.51.0/work/kio-5.51.0/src/ioslaves/help/kio_help.cpp:146
#15 0x00007fb48f41fb12 in kdemain (argc=<optimized out>, argv=<optimized out>) at /var/tmp/paludis/build/kde-frameworks-kio-5.51.0/work/kio-5.51.0/src/ioslaves/help/main.cpp:57
#16 0x000056011bbc39e8 in launch (argc=4, _name=0x56011cf81a38 "/usr/x86_64-pc-linux-gnu/lib/qt5/plugins/kf5/kio/help.so", args=<optimized out>, cwd=<optimized out>, envc=0, envs=<optimized out>, reset_env=false, tty=0x0, avoid_loops=false, startup_id_str=0x56011bbc616c "0") at /var/tmp/paludis/build/kde-frameworks-kinit-5.51.0/work/kinit-5.51.0/src/kdeinit/kinit.cpp:706
#17 0x000056011bbc4998 in handle_launcher_request (sock=8, who=<optimized out>) at /var/tmp/paludis/build/kde-frameworks-kinit-5.51.0/work/kinit-5.51.0/src/kdeinit/kinit.cpp:1146
#18 0x000056011bbc523b in handle_requests (waitForPid=0) at /var/tmp/paludis/build/kde-frameworks-kinit-5.51.0/work/kinit-5.51.0/src/kdeinit/kinit.cpp:1339
#19 0x000056011bbc056e in main (argc=5, argv=<optimized out>) at /var/tmp/paludis/build/kde-frameworks-kinit-5.51.0/work/kinit-5.51.0/src/kdeinit/kinit.cpp:1785
[Inferior 1 (process 16180) detached]
Comment 1 Heiko Becker 2018-10-13 13:35:55 UTC
If I revert https://cgit.kde.org/kio.git/commit/?id=d428fc8e6447ede81f1e1911d0b66b39265672f3 it doesn't crash anymore and it becomes usable again, but admittedly I don't understand the why yet.
Comment 2 Michael Pyne 2018-10-13 23:04:26 UTC
Other of the ioslaves in kio seem to create a QCoreApplication manually. This would be required for KCrash, it seems. Adding this for kio_help might work, I'll do so and see if I can reproduce.
Comment 3 Michael Pyne 2018-10-13 23:20:41 UTC
See https://phabricator.kde.org/D16189

With this patch applied to create a QCoreApplication, KHelpCenter doesn't crash kdeinit5 (or anything else).
Comment 4 Heiko Becker 2018-10-14 06:22:34 UTC
David also wrote: https://phabricator.kde.org/D16183 which I guess might be better at least for 5.51.0 in case there are other kioslaves which also don't create a QtCoreApp.
Comment 5 Michael Pyne 2018-10-14 16:10:03 UTC
Git commit cf3b0d102855a4a90db3fb65a99e0009fcdd3755 by Michael Pyne.
Committed on 14/10/2018 at 16:09.
Pushed by mpyne into branch 'master'.

kio_help: Fix crash in QCoreApplication when accessing help://.

A recent commit d428fc8e6447ede81f1e1911d0b66b39265672f3 removed old
custom crash handling code in favor of KCrash. But this actually adds a
dependency on there being a valid QCoreApplication object.

I took from the example of the similar kio_file to simply create the
QCoreApplication here.

Differential Revision: https://phabricator.kde.org/D16189

M  +4    -0    src/ioslaves/help/main.cpp

https://commits.kde.org/kio/cf3b0d102855a4a90db3fb65a99e0009fcdd3755
Comment 6 Michael Pyne 2018-10-14 16:11:57 UTC
D16183 is a more general fix so I'm glad to have that go in, but all the same we're still *supposed* to have a QCoreApplication (e.g. for translation) so I've pushed this fix as well.