From fb1667ac9a5437b4784d2806a3e816cbdbe404a5 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Thu, 7 Jan 2016 13:37:42 +0000 Subject: [PATCH 3/8] Fix QDBusArgument assertion On my system kded5 crashes with the assertion "QDBusArgument: read from a write-only object" otherwise --- core/polkitqt1-authority.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/polkitqt1-authority.cpp b/core/polkitqt1-authority.cpp index 155493e..efa8271 100644 --- a/core/polkitqt1-authority.cpp +++ b/core/polkitqt1-authority.cpp @@ -233,11 +233,17 @@ void Authority::Private::init() // then we need to extract all seats from ConsoleKit QDBusMessage msg = QDBusMessage::createMethodCall(consoleKitService, consoleKitManagerPath, consoleKitManagerInterface, "GetSeats"); - msg = m_systemBus->call(msg); - if (!msg.arguments().isEmpty()) { + const QDBusMessage reply = m_systemBus->call(msg); + + if (reply.type() != QDBusMessage::ErrorMessage && !reply.arguments().isEmpty()) { // this method returns a list with present seats - QList seats; - qVariantValue (msg.arguments()[0]) >> seats; + QStringList seats; + QVariant arg = reply.arguments()[0]; + if (arg.type() == qMetaTypeId()) { + arg.value() >> seats; + } else { + seats = arg.toStringList(); + } // it can be multiple seats present so connect all their signals Q_FOREACH(const QString &seat, seats) { seatSignalsConnect(seat); -- 2.5.0