Get StatusNotifierWatcher property ProtocolVersion in async way

Review Request #128681 - Created Aug. 15, 2016 and submitted

Information
Martin Flöser
knotifications
master
9526c52...
Reviewers
kdeframeworks
bshah, mart
The ProtocolVersion property was read in a blocking way resulting in a
freeze of the windowing systems. See [1]. A way to reproduce this is:

1. Start a new DBus session through
   export $(dbus-launch)
2. Start a nested KWin:
   kwin_wayland --xwayland konsole
3. Lock the screen, by e.g. entering in the konsole
   qdbus org.freedesktop.ScreenSaver /org/freedesktop/ScreenSaver SetActive true
4. Now observe the freeze of KWin if KWin has Virtual Keyboard support
   (which uses an SNI)

This change gets the ProtocolVersion property in an async way by using a
QDBusPendingCallWatcher. With this change the above steps do not result
in a freeze of the windowing system any more and the availablility of the
SNIWatcher is correctly recognized.

[1]
0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
1  0x00007fffef6c1b9b in QWaitConditionPrivate::wait (time=18446744073709551615, this=0x2c47dc0) at thread/qwaitcondition_unix.cpp:143
2  QWaitCondition::wait (this=this@entry=0xb826e0, mutex=mutex@entry=0xb826d8, time=time@entry=18446744073709551615) at thread/qwaitcondition_unix.cpp:215
3  0x00007ffff0bbda24 in QDBusPendingCallPrivate::waitForFinished (this=this@entry=0xb826a0) at qdbuspendingcall.cpp:240
4  0x00007ffff0b7c080 in QDBusConnectionPrivate::sendWithReply (this=0x7fffd8003460, message=..., sendMode=1, timeout=-1) at qdbusintegrator.cpp:2035
5  0x00007ffff0b69fe3 in QDBusConnection::call (this=this@entry=0x63ad40, message=..., mode=mode@entry=QDBus::Block, timeout=<optimized out>) at qdbusconnection.cpp:697
6  0x00007ffff0b84edc in QDBusAbstractInterfacePrivate::property (this=0x63acd0, mp=..., returnValuePtr=0x7fffffffc7e0) at qdbusabstractinterface.cpp:179
7  0x00007ffff0b8728b in QDBusAbstractInterfaceBase::qt_metacall (this=this@entry=0x1380810, _c=_c@entry=QMetaObject::ReadProperty, _id=<optimized out>, _a=_a@entry=0x7fffffffc810) at qdbusabstractinterface.cpp:290
8  0x00007ffff0b873f7 in QDBusAbstractInterface::qt_metacall (this=0x1380810, _c=QMetaObject::ReadProperty, _id=<optimized out>, _a=0x7fffffffc810) at .moc/moc_qdbusabstractinterface.cpp:97
9  0x00007ffff4631526 in OrgKdeStatusNotifierWatcherInterface::qt_metacall (this=0x1380810, _c=QMetaObject::ReadProperty, _id=2, _a=0x7fffffffc810) at /opt/build/kf5/frameworks/knotifications/src/statusnotifierwatcher_interface.moc:188
10 0x00007fffef894d6e in QMetaProperty::read (this=this@entry=0x7fffffffc880, object=object@entry=0x1380810) at kernel/qmetaobject.cpp:3027
11 0x00007fffef8b011f in QObject::property (this=0x1380810, name=0x7ffff4636d99 "ProtocolVersion") at kernel/qobject.cpp:3920
12 0x00007ffff4614085 in KStatusNotifierItemPrivate::registerToDaemon (this=0x1375020) at /home/martin/src/kf5/frameworks/knotifications/src/kstatusnotifieritem.cpp:738
13 0x00007ffff46143d2 in KStatusNotifierItemPrivate::setLegacyMode (this=0x1375020, legacy=false) at /home/martin/src/kf5/frameworks/knotifications/src/kstatusnotifieritem.cpp:776
14 0x00007ffff4614300 in KStatusNotifierItemPrivate::serviceChange (this=0x1375020, name=..., oldOwner=..., newOwner=...) at /home/martin/src/kf5/frameworks/knotifications/src/kstatusnotifieritem.cpp:759
15 0x00007ffff4615746 in KStatusNotifierItem::qt_static_metacall (_o=0x1384a00, _c=QMetaObject::InvokeMetaMethod, _id=5, _a=0x7fffffffcca0) at /opt/build/kf5/frameworks/knotifications/src/moc_kstatusnotifieritem.cpp:184
16 0x00007fffef8b1389 in QMetaObject::activate (sender=sender@entry=0x1385ec0, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7fffffffcca0) at kernel/qobject.cpp:3740
17 0x00007fffef8b1d47 in QMetaObject::activate (sender=sender@entry=0x1385ec0, m=m@entry=0x7ffff0bd9a40 <QDBusServiceWatcher::staticMetaObject>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7fffffffcca0)
    at kernel/qobject.cpp:3602
18 0x00007ffff0bbed1f in QDBusServiceWatcher::serviceOwnerChanged (this=this@entry=0x1385ec0, _t1=..., _t2=..., _t3=...) at .moc/moc_qdbusservicewatcher.cpp:222
19 0x00007ffff0bbedbf in QDBusServiceWatcherPrivate::_q_serviceOwnerChanged (this=<optimized out>, service=..., oldOwner=..., newOwner=...) at qdbusservicewatcher.cpp:76
20 0x00007ffff0bbf2bf in QDBusServiceWatcher::qt_static_metacall (_o=_o@entry=0x1385ec0, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=3, _a=_a@entry=0x7fffffffce60) at .moc/moc_qdbusservicewatcher.cpp:99
21 0x00007ffff0bbf650 in QDBusServiceWatcher::qt_metacall (this=0x1385ec0, _c=QMetaObject::InvokeMetaMethod, _id=3, _a=0x7fffffffce60) at .moc/moc_qdbusservicewatcher.cpp:177
22 0x00007ffff0b74fb3 in QDBusConnectionPrivate::deliverCall (this=<optimized out>, object=<optimized out>, msg=..., metaTypes=..., slotIdx=<optimized out>) at qdbusintegrator.cpp:983
23 0x00007fffef8b21c1 in QObject::event (this=0x1385ec0, e=<optimized out>) at kernel/qobject.cpp:1263
24 0x00007ffff015822c in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x1385ec0, e=0x7fffd8016bb0) at kernel/qapplication.cpp:3799
25 0x00007ffff015f5e6 in QApplication::notify (this=0x7fffffffd580, receiver=0x1385ec0, e=0x7fffd8016bb0) at kernel/qapplication.cpp:3556
26 0x00007fffef888398 in QCoreApplication::notifyInternal2 (receiver=0x1385ec0, event=event@entry=0x7fffd8016bb0) at kernel/qcoreapplication.cpp:988
27 0x00007fffef88a98b in QCoreApplication::sendEvent (event=0x7fffd8016bb0, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
28 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x639430) at kernel/qcoreapplication.cpp:1649
29 0x00007fffef8d555a in QEventDispatcherUNIX::processEvents (this=0x64f020, flags=..., flags@entry=...) at kernel/qeventdispatcher_unix.cpp:461
30 0x00007fffdf811cfd in QUnixEventDispatcherQPA::processEvents (this=<optimized out>, flags=...) at eventdispatchers/qunixeventdispatcher.cpp:68
31 0x00007fffef88690a in QEventLoop::exec (this=this@entry=0x7fffffffd340, flags=..., flags@entry=...) at kernel/qeventloop.cpp:210
32 0x00007fffef88e8ed in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1261
33 0x000000000040ca2d in main (argc=5, argv=0x7fffffffdf68) at /home/martin/src/kf5/kde/workspace/kwin/main_wayland.cpp:741

  
Marco Martin
Martin Flöser
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit e4ce18500c672521861fdb84c5c3f4350ba871ab by Martin Gräßlin to branch master.
Loading...