This commit is contained in:
committed by
Git OBS Bridge
parent
7bf8d0e1e8
commit
e7c4ccef86
80
do-not-use-global-static-systembus-instance.patch
Normal file
80
do-not-use-global-static-systembus-instance.patch
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
From: Harald Sitter <sitter@kde.org>
|
||||||
|
Date: Fri, 01 Aug 2014 14:34:03 +0000
|
||||||
|
Subject: do not use global static systembus instance
|
||||||
|
X-Git-Url: http://quickgit.kde.org/?p=polkit-qt-1.git&a=commitdiff&h=88c6e9334c8440721189ef7d020fa94d47f30f8b
|
||||||
|
---
|
||||||
|
do not use global static systembus instance
|
||||||
|
|
||||||
|
global static destruction order cannot be controlled and we need our bus
|
||||||
|
to disconnect from the consolekit signals, so use our own bus instance
|
||||||
|
to connect to systembus signals
|
||||||
|
|
||||||
|
REVIEW: 119545
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
--- a/core/polkitqt1-authority.cpp
|
||||||
|
+++ b/core/polkitqt1-authority.cpp
|
||||||
|
@@ -83,7 +83,10 @@
|
||||||
|
// Polkit will return NULL on failures, hence we use it instead of 0
|
||||||
|
Private(Authority *qq) : q(qq)
|
||||||
|
, pkAuthority(NULL)
|
||||||
|
- , m_hasError(false) {}
|
||||||
|
+ , m_hasError(false)
|
||||||
|
+ , m_systemBus(0)
|
||||||
|
+ {
|
||||||
|
+ }
|
||||||
|
|
||||||
|
~Private();
|
||||||
|
|
||||||
|
@@ -103,6 +106,13 @@
|
||||||
|
bool m_hasError;
|
||||||
|
Authority::ErrorCode m_lastError;
|
||||||
|
QString m_errorDetails;
|
||||||
|
+ // Local system bus. QDBusConnection::systemBus() may only be savely used
|
||||||
|
+ // inside a QCoreApplication scope as for example destruction of connected
|
||||||
|
+ // objects need to happen before the bus disappears. Since this class however
|
||||||
|
+ // is a global static and systemBus() internally is a global static we
|
||||||
|
+ // cannot assure destruction order. Instead we create a local copy of the
|
||||||
|
+ // global systemBus instance so we can make life time to our needs.
|
||||||
|
+ // This prevents crashes when cleaning up the global statics.
|
||||||
|
QDBusConnection *m_systemBus;
|
||||||
|
GCancellable *m_checkAuthorizationCancellable,
|
||||||
|
*m_enumerateActionsCancellable,
|
||||||
|
@@ -127,6 +137,7 @@
|
||||||
|
|
||||||
|
Authority::Private::~Private()
|
||||||
|
{
|
||||||
|
+ delete m_systemBus;
|
||||||
|
g_object_unref(m_checkAuthorizationCancellable);
|
||||||
|
g_object_unref(m_enumerateActionsCancellable);
|
||||||
|
g_object_unref(m_registerAuthenticationAgentCancellable);
|
||||||
|
@@ -169,6 +180,9 @@
|
||||||
|
QDBusError dbus_error;
|
||||||
|
|
||||||
|
g_type_init();
|
||||||
|
+
|
||||||
|
+ m_systemBus = new QDBusConnection(QDBusConnection::connectToBus(QDBusConnection::SystemBus,
|
||||||
|
+ QString("polkit_qt_system_bus")));
|
||||||
|
|
||||||
|
m_checkAuthorizationCancellable = g_cancellable_new();
|
||||||
|
m_enumerateActionsCancellable = g_cancellable_new();
|
||||||
|
@@ -219,7 +233,7 @@
|
||||||
|
|
||||||
|
// then we need to extract all seats from ConsoleKit
|
||||||
|
QDBusMessage msg = QDBusMessage::createMethodCall(consoleKitService, consoleKitManagerPath, consoleKitManagerInterface, "GetSeats");
|
||||||
|
- msg = QDBusConnection::systemBus().call(msg);
|
||||||
|
+ msg = m_systemBus->call(msg);
|
||||||
|
if (!msg.arguments().isEmpty()) {
|
||||||
|
// this method returns a list with present seats
|
||||||
|
QList<QString> seats;
|
||||||
|
@@ -256,8 +270,7 @@
|
||||||
|
void Authority::Private::dbusSignalAdd(const QString &service, const QString &path, const QString &interface, const QString &name)
|
||||||
|
{
|
||||||
|
// FIXME: This code seems to be nonfunctional - it needs to be fixed somewhere (is it Qt BUG?)
|
||||||
|
- QDBusConnection::systemBus().connect(service, path, interface, name,
|
||||||
|
- q, SLOT(dbusFilter(QDBusMessage)));
|
||||||
|
+ m_systemBus->connect(service, path, interface, name, q, SLOT(dbusFilter(QDBusMessage)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Authority::Private::dbusFilter(const QDBusMessage &message)
|
@@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Aug 13 20:32:57 UTC 2014 - hrvoje.senjan@gmail.com
|
||||||
|
|
||||||
|
- Added do-not-use-global-static-systembus-instance.patch from
|
||||||
|
upstream, fixes crash on DBus disconnect
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Jul 10 18:09:39 UTC 2014 - hrvoje.senjan@gmail.com
|
Thu Jul 10 18:09:39 UTC 2014 - hrvoje.senjan@gmail.com
|
||||||
|
|
||||||
|
@@ -25,6 +25,8 @@ Group: Development/Libraries/KDE
|
|||||||
Url: http://api.kde.org/kdesupport-api/kdesupport-apidocs/polkit-qt/html/
|
Url: http://api.kde.org/kdesupport-api/kdesupport-apidocs/polkit-qt/html/
|
||||||
Source: http://download.kde.org/stable/apps/KDE4.x/admin/polkit-qt-1-%{version}.tar.bz2
|
Source: http://download.kde.org/stable/apps/KDE4.x/admin/polkit-qt-1-%{version}.tar.bz2
|
||||||
Source1: baselibs.conf
|
Source1: baselibs.conf
|
||||||
|
# PATCH-FIX-UPSTREAM do-not-use-global-static-systembus-instance.patch
|
||||||
|
Patch0: do-not-use-global-static-systembus-instance.patch
|
||||||
BuildRequires: cmake >= 2.8.12
|
BuildRequires: cmake >= 2.8.12
|
||||||
BuildRequires: extra-cmake-modules
|
BuildRequires: extra-cmake-modules
|
||||||
BuildRequires: kf5-filesystem
|
BuildRequires: kf5-filesystem
|
||||||
@@ -66,6 +68,7 @@ with PolicyKit.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n polkit-qt-1-%{version}
|
%setup -q -n polkit-qt-1-%{version}
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%cmake_kf5 -d build -- -DUSE_QT5=ON -DUSE_QT4=OFF
|
%cmake_kf5 -d build -- -DUSE_QT5=ON -DUSE_QT4=OFF
|
||||||
|
Reference in New Issue
Block a user