Tier 2 part 1

This commit is contained in:
Ertuğrul Erata
2015-07-24 22:40:54 +03:00
parent 4a9cb8f8be
commit 7955f769d9
16 changed files with 451 additions and 82 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/copyleft/gpl.txt
from pisi.actionsapi import cmaketools
from pisi.actionsapi import get
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
def setup():
shelltools.makedirs("build")
shelltools.cd("build")
cmaketools.configure("-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLIB_DESTINATION=/usr/lib", sourceDir="..")
def build():
shelltools.cd("build")
cmaketools.make()
def install():
shelltools.cd("build")
cmaketools.rawInstall("DESTDIR=%s" % get.installDIR())
shelltools.cd("..")
pisitools.dodoc("AUTHORS", "COPYING")
@@ -0,0 +1,80 @@
commit 88c6e9334c8440721189ef7d020fa94d47f30f8b
Author: Harald Sitter <sitter@kde.org>
Date: Fri Aug 1 16:34:03 2014 +0200
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
diff --git a/core/polkitqt1-authority.cpp b/core/polkitqt1-authority.cpp
index dd014cf..f25354d 100644
--- a/core/polkitqt1-authority.cpp
+++ core/polkitqt1-authority.cpp
@@ -83,7 +83,10 @@ public:
// 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 @@ public:
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 @@ public:
Authority::Private::~Private()
{
+ delete m_systemBus;
g_object_unref(m_checkAuthorizationCancellable);
g_object_unref(m_enumerateActionsCancellable);
g_object_unref(m_registerAuthenticationAgentCancellable);
@@ -170,6 +181,9 @@ void Authority::Private::init()
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();
m_registerAuthenticationAgentCancellable = g_cancellable_new();
@@ -219,7 +233,7 @@ void Authority::Private::init()
// 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::seatSignalsConnect(const QString &seat)
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)
+58
View File
@@ -0,0 +1,58 @@
<PISI>
<Source>
<Name>polkit-qt</Name>
<Homepage>http://www.lxde.org</Homepage>
<Packager>
<Name>Ayhan Yalçınsoy</Name>
<Email>ayhanyalcinsoy@pisilinux.org</Email>
</Packager>
<License>GPL2</License>
<IsA>app:gui</IsA>
<Summary>A library that allows developers to access PolicyKit API with a nice Qt-style API</Summary>
<Description>A library that allows developers to access PolicyKit API with a nice Qt-style API</Description>
<Archive sha1sum="042b8a42e88bd578c27600e9b70c4e142a39da91" type="tarbz2">http://source.pisilinux.org/1.0/polkit-qt-1-0.112.0.tar.bz2</Archive>
<BuildDependencies>
<Dependency>qt5-base-devel</Dependency>
<Dependency>glib2-devel</Dependency>
<Dependency>polkit-devel</Dependency>
<Dependency>cmake</Dependency>
</BuildDependencies>
<Patches>
<Patch>systembus-usage.patch</Patch>
</Patches>
</Source>
<Package>
<Name>polkit-qt</Name>
<RuntimeDependencies>
<Dependency>qt5-base</Dependency>
<Dependency>glib2</Dependency>
<Dependency>polkit</Dependency>
<Dependency>libgcc</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="doc">/usr/share/doc</Path>
<Path fileType="library">/usr/lib</Path>
</Files>
</Package>
<Package>
<Name>polkit-qt-devel</Name>
<RuntimeDependencies>
<Dependency>qt5-base-devel</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="library">/usr/lib/pkgconfig</Path>
<Path fileType="headers">/usr/include/polkit-qt5-1</Path>
</Files>
</Package>
<History>
<Update release="1">
<Date>2015-05-13</Date>
<Version>0.112</Version>
<Comment>First Release</Comment>
<Name>Ayhan Yalçınsoy</Name>
<Email>ayhanyalcinsoy@pisilinux.org</Email>
</Update>
</History>
</PISI>
@@ -0,0 +1,7 @@
<PISI>
<Source>
<Name>lxqt-policykit</Name>
<Summary xml:lang="tr">Policykit agent.</Summary>
<Description xml:lang="tr">LXQt policykit doğrulama aracı.</Description>
</Source>
</PISI>
@@ -46,6 +46,7 @@
</Files>
<RuntimeDependencies>
<Dependency>qt5-base-devel</Dependency>
<Dependency release="current">qt5-declarative</Dependency>
</RuntimeDependencies>
</Package>