Bug 307225

Summary: KAction::setGlobalShortcut() crashes when called after creating an unrelated QDBusInterface instance
Product: [Unmaintained] kdelibs Reporter: Peter Grasch <me>
Component: shortcutsAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED WORKSFORME    
Severity: crash CC: aspotashev, dantti12, jakbest, jeroen, kubry
Priority: NOR Keywords: testcase
Version: 4.9.1   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: main.cpp
QMake file
New crash information added by DrKonqi

Description Peter Grasch 2012-09-22 17:46:34 UTC
Okay, this is a very weird bug. That's why instead of trying to explain anything, I'll just link a small test case that crashes for me and for a colleague running Arch.

I sadly can't provide a good backtrace as I don't have debug symbols and installing on Gentoo means recompiling a lot of stuff.

Reproducible: Always

Steps to Reproduce:
1. Download http://paste.kde.org/554912/ and safe as main.cpp
2. Download http://paste.kde.org/554918/ and safe as <foldername>.pro
3. Compile and run: qmake && make && ./<foldername>
Actual Results:  
Crashes

Expected Results:  
Shouldn't crash

Backtrace (without debug symbols, sorry):

Thread 1 (Thread 0x7fac8b61b780 (LWP 17606)):
[KCrash Handler]
#6  0x00007fac89425be9 in QVariant::QVariant(QVariant const&) () from /usr/lib64/qt4/libQtCore.so.4
#7  0x00007fac8a6ad5e6 in QDBusPendingReplyData::argumentAt(int) const () from /usr/lib64/qt4/libQtDBus.so.4
#8  0x00007fac8ab739b3 in ?? () from /usr/lib64/libkdeui.so.5
#9  0x00007fac8aa44a52 in KAction::setGlobalShortcut(KShortcut const&, QFlags<KAction::ShortcutType>, KAction::GlobalShortcutLoading) () from /usr/lib64/libkdeui.so.5
#10 0x0000000000401921 in main ()
Comment 1 Jekyll Wu 2012-09-23 11:27:40 UTC
A better backtrace


Application: foo (sample), signal: Segmentation fault
Using host libthread_db library "/lib/libthread_db.so.1".
[KCrash Handler]
#7  Private (other=..., this=0xbfd75ee4) at kernel/qvariant.h:356
#8  QVariant::QVariant (this=0xbfd75ee4, p=...) at kernel/qvariant.cpp:1423
#9  0xb70002c5 in QDBusPendingReplyData::argumentAt(int) const () from /usr/lib/qt4/libQtDBus.so.4
#10 0xb727ef04 in argumentAt<0> (this=0xbfd75f4c) at /usr/include/qt4/QtDBus/qdbuspendingreply.h:176
#11 operator QDBusPendingReplyTypes::Select<0, QList<int>, void, void, void, void, void, void, void>::Type (this=0xbfd75f4c) at /usr/include/qt4/QtDBus/qdbuspendingreply.h:186
#12 KGlobalAccelPrivate::updateGlobalShortcut (this=0x9af90b8, action=0x9acd588, flags=3) at /mnt/personal/build/portage/kde-base/kdelibs-9999/work/kdelibs-9999/kdeui/shortcuts/kglobalaccel.cpp:325
#13 0xb712500f in KAction::setGlobalShortcut (this=0x9acd588, shortcut=..., type=..., load=KAction::Autoloading) at /mnt/personal/build/portage/kde-base/kdelibs-9999/work/kdelibs-9999/kdeui/actions/kaction.cpp:284
#14 0x08049480 in main ()
Comment 2 Ganton 2012-11-17 11:04:16 UTC
Created attachment 75311 [details]
main.cpp

The original "main.cpp".
Comment 3 Ganton 2012-11-17 11:05:40 UTC
> Download http://paste.kde.org/554918/ and safe as <foldername>.pro
It says "The paste you are looking for does not exist" :-(

Can anyone re-upload it?
Comment 4 Peter Grasch 2012-11-18 10:53:15 UTC
Created attachment 75330 [details]
QMake file
Comment 5 Daniel Nicoletti 2013-05-06 02:41:20 UTC
This is a Qt bug, I reported and it was fixed in 5.x series, but one at kdelibs needs to do an workaround.
What happens is that when QDBusPendindReply fails to get a reply argumentAt<0> doesn't have anything and it crashes the code, to workaround once can check if isError() or use QDBusReply instead.
Comment 6 Jekyll Wu 2013-06-11 03:29:15 UTC
*** Bug 320994 has been marked as a duplicate of this bug. ***
Comment 7 jakbest 2014-04-07 01:17:51 UTC
Created attachment 85982 [details]
New crash information added by DrKonqi

kactivitymanagerd (3.0) on KDE Platform 4.11.5 using Qt 4.8.4

- What I was doing when the application crashed:
Shutting Down My Monitor TV or my 5.1 surround sound system cause kwin to freeze or crash. Sometimes it require about 30 minutes, sometimes the bug happens immediately.  Possibly the only cause is the yamaha and not the monitor TV, but In my opinion the problem happens when there isn't an output source... Sometimes when KWin doesn't crash, it create some graphic glitches and the GUI isn't usable.
- Unusual behavior I noticed:
Kwin Crash, Freeze or create graphic Glitches.
- Custom settings of the application:
My PC is connected to a Yamaha HTR-3063 (5.1 surround sound system) with an HDMI Cable, then the system has an HDMI cable that goes from the 5.1 system to the Monitor TV.

- Temporary Solutions:
Restart it by tty with "DISPLAY=:0 kwin --replace".
One time Kwin loaded the CPU to 100% and didn't want to stop, solved (by tty of course) with "killall -9 kwin".

Sorry if my english is bad!

-- Backtrace (Reduced):
#6  Private (other=..., this=0x7fff2115f3f0) at ../../include/QtCore/../../src/corelib/kernel/qvariant.h:356
#7  QVariant::QVariant (this=0x7fff2115f3f0, p=...) at kernel/qvariant.cpp:1423
#8  0x00007fe7b2478d6d in QDBusPendingReplyData::argumentAt (this=this@entry=0x7fff2115f3b0, index=index@entry=0) at qdbuspendingreply.cpp:270
#9  0x00007fe7b28fa337 in argumentAt<0> (this=0x7fff2115f3b0) at /usr/include/qt4/QtDBus/qdbuspendingreply.h:176
#10 operator QDBusPendingReplyTypes::Select<0, QList<int>, void, void, void, void, void, void, void>::Type (this=0x7fff2115f3b0) at /usr/include/qt4/QtDBus/qdbuspendingreply.h:186
Comment 8 Justin Zobel 2022-09-30 04:39:04 UTC
Thank you for reporting this crash in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the crash with a recent software version?

If you can reproduce the issue, please change the status to "CONFIRMED" when replying. Thank you!
Comment 9 Bug Janitor Service 2022-10-15 04:55:21 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 10 Bug Janitor Service 2022-10-30 05:03:54 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!