forked from pool/libqt5-qtbase
Accepting request 434015 from KDE:Qt5
1 OBS-URL: https://build.opensuse.org/request/show/434015 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=57
This commit is contained in:
parent
8b9e88c08a
commit
67a95093f9
120
Fix-some-QtDBus-crashes-during-application-destruction.patch
Normal file
120
Fix-some-QtDBus-crashes-during-application-destruction.patch
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
From d060b7aa5fc64902ea89416e58b57d6a90f5aea6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Thiago Macieira <thiago.macieira@intel.com>
|
||||||
|
Date: Tue, 31 May 2016 17:33:03 -0300
|
||||||
|
Subject: [PATCH] Fix some QtDBus crashes during application destruction
|
||||||
|
|
||||||
|
It's possible that some code executes after QDBusConnectionManager is
|
||||||
|
destroyed and still tries to access QtDBus. Protect against such
|
||||||
|
crashes.
|
||||||
|
|
||||||
|
Change-Id: I87e17314d8b24ae983b1fffd1453c13fbd3cf48e
|
||||||
|
---
|
||||||
|
src/dbus/qdbusconnection.cpp | 12 ++++++++----
|
||||||
|
src/dbus/qdbusintegrator.cpp | 3 +++
|
||||||
|
src/dbus/qdbusserver.cpp | 12 ++++++++++--
|
||||||
|
3 files changed, 21 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
|
||||||
|
index 4db6396..c1c4f05 100644
|
||||||
|
--- a/src/dbus/qdbusconnection.cpp
|
||||||
|
+++ b/src/dbus/qdbusconnection.cpp
|
||||||
|
@@ -429,7 +429,7 @@ void QDBusConnectionManager::createServer(const QString &address, void *server)
|
||||||
|
*/
|
||||||
|
QDBusConnection::QDBusConnection(const QString &name)
|
||||||
|
{
|
||||||
|
- if (name.isEmpty()) {
|
||||||
|
+ if (name.isEmpty() || _q_manager.isDestroyed()) {
|
||||||
|
d = 0;
|
||||||
|
} else {
|
||||||
|
QMutexLocker locker(&_q_manager()->mutex);
|
||||||
|
@@ -494,7 +494,7 @@ QDBusConnection &QDBusConnection::operator=(const QDBusConnection &other)
|
||||||
|
*/
|
||||||
|
QDBusConnection QDBusConnection::connectToBus(BusType type, const QString &name)
|
||||||
|
{
|
||||||
|
- if (!qdbus_loadLibDBus()) {
|
||||||
|
+ if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) {
|
||||||
|
QDBusConnectionPrivate *d = 0;
|
||||||
|
return QDBusConnection(d);
|
||||||
|
}
|
||||||
|
@@ -508,7 +508,7 @@ QDBusConnection QDBusConnection::connectToBus(BusType type, const QString &name)
|
||||||
|
QDBusConnection QDBusConnection::connectToBus(const QString &address,
|
||||||
|
const QString &name)
|
||||||
|
{
|
||||||
|
- if (!qdbus_loadLibDBus()) {
|
||||||
|
+ if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) {
|
||||||
|
QDBusConnectionPrivate *d = 0;
|
||||||
|
return QDBusConnection(d);
|
||||||
|
}
|
||||||
|
@@ -523,7 +523,7 @@ QDBusConnection QDBusConnection::connectToBus(const QString &address,
|
||||||
|
QDBusConnection QDBusConnection::connectToPeer(const QString &address,
|
||||||
|
const QString &name)
|
||||||
|
{
|
||||||
|
- if (!qdbus_loadLibDBus()) {
|
||||||
|
+ if (_q_manager.isDestroyed() || !qdbus_loadLibDBus()) {
|
||||||
|
QDBusConnectionPrivate *d = 0;
|
||||||
|
return QDBusConnection(d);
|
||||||
|
}
|
||||||
|
@@ -1178,6 +1178,8 @@ bool QDBusConnection::unregisterService(const QString &serviceName)
|
||||||
|
*/
|
||||||
|
QDBusConnection QDBusConnection::sessionBus()
|
||||||
|
{
|
||||||
|
+ if (_q_manager.isDestroyed())
|
||||||
|
+ return QDBusConnection(Q_NULLPTR);
|
||||||
|
return QDBusConnection(_q_manager()->busConnection(SessionBus));
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1190,6 +1192,8 @@ QDBusConnection QDBusConnection::sessionBus()
|
||||||
|
*/
|
||||||
|
QDBusConnection QDBusConnection::systemBus()
|
||||||
|
{
|
||||||
|
+ if (_q_manager.isDestroyed())
|
||||||
|
+ return QDBusConnection(Q_NULLPTR);
|
||||||
|
return QDBusConnection(_q_manager()->busConnection(SystemBus));
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
|
||||||
|
index 37d2ae1..9ea30d1 100644
|
||||||
|
--- a/src/dbus/qdbusintegrator.cpp
|
||||||
|
+++ b/src/dbus/qdbusintegrator.cpp
|
||||||
|
@@ -293,6 +293,9 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
|
||||||
|
Q_ASSERT(connection);
|
||||||
|
Q_ASSERT(data);
|
||||||
|
|
||||||
|
+ if (!QDBusConnectionManager::instance())
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
// keep the connection alive
|
||||||
|
q_dbus_connection_ref(connection);
|
||||||
|
QDBusConnectionPrivate *serverConnection = static_cast<QDBusConnectionPrivate *>(data);
|
||||||
|
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp
|
||||||
|
index babb270..ecb7d4f 100644
|
||||||
|
--- a/src/dbus/qdbusserver.cpp
|
||||||
|
+++ b/src/dbus/qdbusserver.cpp
|
||||||
|
@@ -62,7 +62,11 @@ QDBusServer::QDBusServer(const QString &address, QObject *parent)
|
||||||
|
if (!qdbus_loadLibDBus())
|
||||||
|
return;
|
||||||
|
|
||||||
|
- emit QDBusConnectionManager::instance()->serverRequested(address, this);
|
||||||
|
+ QDBusConnectionManager *instance = QDBusConnectionManager::instance();
|
||||||
|
+ if (!instance)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ emit instance->serverRequested(address, this);
|
||||||
|
QObject::connect(d, SIGNAL(newServerConnection(QDBusConnectionPrivate*)),
|
||||||
|
this, SLOT(_q_newConnection(QDBusConnectionPrivate*)), Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
@@ -87,7 +91,11 @@ QDBusServer::QDBusServer(QObject *parent)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
- emit QDBusConnectionManager::instance()->serverRequested(address, this);
|
||||||
|
+ QDBusConnectionManager *instance = QDBusConnectionManager::instance();
|
||||||
|
+ if (!instance)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ emit instance->serverRequested(address, this);
|
||||||
|
QObject::connect(d, SIGNAL(newServerConnection(QDBusConnectionPrivate*)),
|
||||||
|
this, SLOT(_q_newConnection(QDBusConnectionPrivate*)), Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.7.4
|
@ -0,0 +1,58 @@
|
|||||||
|
From ebf0b121084822ce754c14ed7255bde0f90bf42f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Thiago Macieira <thiago.macieira@intel.com>
|
||||||
|
Date: Tue, 6 Sep 2016 11:41:00 -0700
|
||||||
|
Subject: [PATCH] Make QDBusConnectionPrivate::relaySignal be called in the
|
||||||
|
right thread
|
||||||
|
|
||||||
|
This function sends D-Bus messages directly (in huntAndEmit), so it
|
||||||
|
should only be called from the QDBusConnectionManager thread. Somehow, I
|
||||||
|
missed this in the Qt 5.6 refactoring of QtDBus.
|
||||||
|
|
||||||
|
Being called in the wrong thread means that there's a visible behavior
|
||||||
|
change compared to Qt 5.5: if the user code sent a method call or method
|
||||||
|
return/error and then emitted a signal, we'd have two threads racing to
|
||||||
|
send the D-Bus messages. This was observed in Telepathy-Qt code: certain
|
||||||
|
signals arrived before a method return, even though they were clearly
|
||||||
|
emitted by a queued QMetaObject::invokeMethod.
|
||||||
|
|
||||||
|
In addition to that, we have has an internal problem (though not
|
||||||
|
observed): the libdbus-1 timer and socket callbacks would be called in
|
||||||
|
the wrong thread and we no longer have protection against that.
|
||||||
|
|
||||||
|
Unit testing not possible since this is a race condition.
|
||||||
|
|
||||||
|
Change-Id: I9e96ecd4f6aa4ff0ae08fffd1471d002142613d6
|
||||||
|
Reviewed-by: Gustavo Pichorim Boiko <gustavo.boiko@canonical.com>
|
||||||
|
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
||||||
|
---
|
||||||
|
src/dbus/qdbusintegrator.cpp | 6 ++----
|
||||||
|
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
|
||||||
|
index 878a582..c2cf7f4 100644
|
||||||
|
--- a/src/dbus/qdbusintegrator.cpp
|
||||||
|
+++ b/src/dbus/qdbusintegrator.cpp
|
||||||
|
@@ -1257,6 +1257,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ checkThread();
|
||||||
|
QDBusReadLocker locker(RelaySignalAction, this);
|
||||||
|
QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface,
|
||||||
|
QLatin1String(memberName));
|
||||||
|
@@ -2368,12 +2369,9 @@ void QDBusConnectionPrivate::registerObject(const ObjectTreeNode *node)
|
||||||
|
connector->connectAllSignals(node->obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
- // disconnect and reconnect to avoid duplicates
|
||||||
|
- connector->disconnect(SIGNAL(relaySignal(QObject*,const QMetaObject*,int,QVariantList)),
|
||||||
|
- this, SLOT(relaySignal(QObject*,const QMetaObject*,int,QVariantList)));
|
||||||
|
connect(connector, SIGNAL(relaySignal(QObject*,const QMetaObject*,int,QVariantList)),
|
||||||
|
this, SLOT(relaySignal(QObject*,const QMetaObject*,int,QVariantList)),
|
||||||
|
- Qt::DirectConnection);
|
||||||
|
+ Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.7.4
|
@ -0,0 +1,428 @@
|
|||||||
|
From 93eb0169cbec0de47a66c1b78b734863fb921326 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Thiago Macieira <thiago.macieira@intel.com>
|
||||||
|
Date: Thu, 28 Apr 2016 15:00:58 -0700
|
||||||
|
Subject: [PATCH] Merge the QDBusMetaType's custom information to
|
||||||
|
QDBusConnectionManager
|
||||||
|
|
||||||
|
This allows us to get rid of two Q_GLOBAL_STATIC in QtDBus, which means
|
||||||
|
fewer opportunities for screwing up the order of destruction. And since
|
||||||
|
QDBusConnectionManager now ensures that the types are initialized, we
|
||||||
|
don't need to re-initialize them everywhere.
|
||||||
|
|
||||||
|
The Q_GLOBAL_STATIC for QDBusConnectionManager ensures the proper
|
||||||
|
thread-safe locking, so we don't need to lock for every type that we're
|
||||||
|
trying to register. This should make things faster.
|
||||||
|
|
||||||
|
But as a side-effect, trying to register a D-Bus metatype will cause the
|
||||||
|
QDBusConnectionManager thread to start too.
|
||||||
|
|
||||||
|
Change-Id: Ifea6e497f11a461db432ffff1449a4e535234485
|
||||||
|
---
|
||||||
|
src/dbus/qdbusconnection.cpp | 1 +
|
||||||
|
src/dbus/qdbusconnectionmanager_p.h | 3 +-
|
||||||
|
src/dbus/qdbusintegrator.cpp | 1 -
|
||||||
|
src/dbus/qdbusmetatype.cpp | 185 +++++++++++++++++++-----------------
|
||||||
|
src/dbus/qdbusmetatype_p.h | 27 +++++-
|
||||||
|
src/dbus/qdbusmisc.cpp | 3 +-
|
||||||
|
6 files changed, 127 insertions(+), 93 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
|
||||||
|
index 34b3da7..4db6396 100644
|
||||||
|
--- a/src/dbus/qdbusconnection.cpp
|
||||||
|
+++ b/src/dbus/qdbusconnection.cpp
|
||||||
|
@@ -193,6 +193,7 @@ void QDBusConnectionManager::run()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connectionHash.clear();
|
||||||
|
+ customTypes.clear();
|
||||||
|
|
||||||
|
// allow deletion from any thread without warning
|
||||||
|
moveToThread(Q_NULLPTR);
|
||||||
|
diff --git a/src/dbus/qdbusconnectionmanager_p.h b/src/dbus/qdbusconnectionmanager_p.h
|
||||||
|
index c0ab48e..97ecc74 100644
|
||||||
|
--- a/src/dbus/qdbusconnectionmanager_p.h
|
||||||
|
+++ b/src/dbus/qdbusconnectionmanager_p.h
|
||||||
|
@@ -48,13 +48,14 @@
|
||||||
|
#define QDBUSCONNECTIONMANAGER_P_H
|
||||||
|
|
||||||
|
#include "qdbusconnection_p.h"
|
||||||
|
+#include "qdbusmetatype_p.h"
|
||||||
|
#include "private/qthread_p.h"
|
||||||
|
|
||||||
|
#ifndef QT_NO_DBUS
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
-class QDBusConnectionManager : public QDaemonThread
|
||||||
|
+class QDBusConnectionManager : public QDaemonThread, public QDBusMetaTypeId
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
struct ConnectionRequestData;
|
||||||
|
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
|
||||||
|
index 3be775d..37d2ae1 100644
|
||||||
|
--- a/src/dbus/qdbusintegrator.cpp
|
||||||
|
+++ b/src/dbus/qdbusintegrator.cpp
|
||||||
|
@@ -1019,7 +1019,6 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
|
||||||
|
qdbusThreadDebug = qdbusDefaultThreadDebug;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- QDBusMetaTypeId::init();
|
||||||
|
connect(this, &QDBusConnectionPrivate::dispatchStatusChanged,
|
||||||
|
this, &QDBusConnectionPrivate::doDispatch, Qt::QueuedConnection);
|
||||||
|
connect(this, &QDBusConnectionPrivate::spyHooksFinished,
|
||||||
|
diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp
|
||||||
|
index 2aaf0e2..ce0d0c8 100644
|
||||||
|
--- a/src/dbus/qdbusmetatype.cpp
|
||||||
|
+++ b/src/dbus/qdbusmetatype.cpp
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2016 The Qt Company Ltd.
|
||||||
|
+** Copyright (C) 2016 Intel Corporation.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the QtDBus module of the Qt Toolkit.
|
||||||
|
@@ -33,19 +34,15 @@
|
||||||
|
|
||||||
|
#include "qdbusmetatype.h"
|
||||||
|
#include "qdbusmetatype_p.h"
|
||||||
|
-
|
||||||
|
-#include <string.h>
|
||||||
|
#include "qdbus_symbols_p.h"
|
||||||
|
|
||||||
|
-#include <qbytearray.h>
|
||||||
|
-#include <qglobal.h>
|
||||||
|
-#include <qreadwritelock.h>
|
||||||
|
-#include <qvector.h>
|
||||||
|
+#include <string.h>
|
||||||
|
|
||||||
|
#include "qdbusargument_p.h"
|
||||||
|
#include "qdbusutil_p.h"
|
||||||
|
#include "qdbusunixfiledescriptor.h"
|
||||||
|
#ifndef QT_BOOTSTRAPPED
|
||||||
|
+#include "qdbusconnectionmanager_p.h"
|
||||||
|
#include "qdbusmessage.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@@ -58,82 +55,72 @@
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
-class QDBusCustomTypeInfo
|
||||||
|
-{
|
||||||
|
-public:
|
||||||
|
- QDBusCustomTypeInfo() : signature(), marshall(0), demarshall(0)
|
||||||
|
- { }
|
||||||
|
-
|
||||||
|
- // Suggestion:
|
||||||
|
- // change 'signature' to char* and make QDBusCustomTypeInfo a Movable type
|
||||||
|
- QByteArray signature;
|
||||||
|
- QDBusMetaType::MarshallFunction marshall;
|
||||||
|
- QDBusMetaType::DemarshallFunction demarshall;
|
||||||
|
-};
|
||||||
|
+static void registerMarshallOperatorsNoLock(QVector<QDBusCustomTypeInfo> &ct, int id,
|
||||||
|
+ QDBusMetaType::MarshallFunction mf,
|
||||||
|
+ QDBusMetaType::DemarshallFunction df);
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
-inline static void registerHelper(T * = 0)
|
||||||
|
+inline static void registerHelper(QVector<QDBusCustomTypeInfo> &ct)
|
||||||
|
{
|
||||||
|
void (*mf)(QDBusArgument &, const T *) = qDBusMarshallHelper<T>;
|
||||||
|
void (*df)(const QDBusArgument &, T *) = qDBusDemarshallHelper<T>;
|
||||||
|
- QDBusMetaType::registerMarshallOperators(qMetaTypeId<T>(),
|
||||||
|
+ registerMarshallOperatorsNoLock(ct, qMetaTypeId<T>(),
|
||||||
|
reinterpret_cast<QDBusMetaType::MarshallFunction>(mf),
|
||||||
|
reinterpret_cast<QDBusMetaType::DemarshallFunction>(df));
|
||||||
|
}
|
||||||
|
|
||||||
|
-void QDBusMetaTypeId::init()
|
||||||
|
+QDBusMetaTypeId *QDBusMetaTypeId::instance()
|
||||||
|
{
|
||||||
|
- static QBasicAtomicInt initialized = Q_BASIC_ATOMIC_INITIALIZER(false);
|
||||||
|
-
|
||||||
|
- // reentrancy is not a problem since everything else is locked on their own
|
||||||
|
- // set the guard variable at the end
|
||||||
|
- if (!initialized.load()) {
|
||||||
|
- // register our types with Qt Core (calling qMetaTypeId<T>() does this implicitly)
|
||||||
|
- (void)message();
|
||||||
|
- (void)argument();
|
||||||
|
- (void)variant();
|
||||||
|
- (void)objectpath();
|
||||||
|
- (void)signature();
|
||||||
|
- (void)error();
|
||||||
|
- (void)unixfd();
|
||||||
|
+#ifdef QT_BOOTSTRAPPED
|
||||||
|
+ static QDBusMetaTypeId self;
|
||||||
|
+ return &self;
|
||||||
|
+#else
|
||||||
|
+ return QDBusConnectionManager::instance();
|
||||||
|
+#endif
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+QDBusMetaTypeId::QDBusMetaTypeId()
|
||||||
|
+{
|
||||||
|
+ // register our types with Qt Core (calling qMetaTypeId<T>() does this implicitly)
|
||||||
|
+ (void)message();
|
||||||
|
+ (void)argument();
|
||||||
|
+ (void)variant();
|
||||||
|
+ (void)objectpath();
|
||||||
|
+ (void)signature();
|
||||||
|
+ (void)error();
|
||||||
|
+ (void)unixfd();
|
||||||
|
|
||||||
|
#ifndef QDBUS_NO_SPECIALTYPES
|
||||||
|
- // and register Qt Core's with us
|
||||||
|
- registerHelper<QDate>();
|
||||||
|
- registerHelper<QTime>();
|
||||||
|
- registerHelper<QDateTime>();
|
||||||
|
- registerHelper<QRect>();
|
||||||
|
- registerHelper<QRectF>();
|
||||||
|
- registerHelper<QSize>();
|
||||||
|
- registerHelper<QSizeF>();
|
||||||
|
- registerHelper<QPoint>();
|
||||||
|
- registerHelper<QPointF>();
|
||||||
|
- registerHelper<QLine>();
|
||||||
|
- registerHelper<QLineF>();
|
||||||
|
- registerHelper<QVariantList>();
|
||||||
|
- registerHelper<QVariantMap>();
|
||||||
|
- registerHelper<QVariantHash>();
|
||||||
|
-
|
||||||
|
- qDBusRegisterMetaType<QList<bool> >();
|
||||||
|
- qDBusRegisterMetaType<QList<short> >();
|
||||||
|
- qDBusRegisterMetaType<QList<ushort> >();
|
||||||
|
- qDBusRegisterMetaType<QList<int> >();
|
||||||
|
- qDBusRegisterMetaType<QList<uint> >();
|
||||||
|
- qDBusRegisterMetaType<QList<qlonglong> >();
|
||||||
|
- qDBusRegisterMetaType<QList<qulonglong> >();
|
||||||
|
- qDBusRegisterMetaType<QList<double> >();
|
||||||
|
- qDBusRegisterMetaType<QList<QDBusObjectPath> >();
|
||||||
|
- qDBusRegisterMetaType<QList<QDBusSignature> >();
|
||||||
|
- qDBusRegisterMetaType<QList<QDBusUnixFileDescriptor> >();
|
||||||
|
+ // and register Qt Core's with us
|
||||||
|
+ registerHelper<QDate>(customTypes);
|
||||||
|
+ registerHelper<QTime>(customTypes);
|
||||||
|
+ registerHelper<QDateTime>(customTypes);
|
||||||
|
+ registerHelper<QRect>(customTypes);
|
||||||
|
+ registerHelper<QRectF>(customTypes);
|
||||||
|
+ registerHelper<QSize>(customTypes);
|
||||||
|
+ registerHelper<QSizeF>(customTypes);
|
||||||
|
+ registerHelper<QPoint>(customTypes);
|
||||||
|
+ registerHelper<QPointF>(customTypes);
|
||||||
|
+ registerHelper<QLine>(customTypes);
|
||||||
|
+ registerHelper<QLineF>(customTypes);
|
||||||
|
+ registerHelper<QVariantList>(customTypes);
|
||||||
|
+ registerHelper<QVariantMap>(customTypes);
|
||||||
|
+ registerHelper<QVariantHash>(customTypes);
|
||||||
|
+
|
||||||
|
+ registerHelper<QList<bool> >(customTypes);
|
||||||
|
+ registerHelper<QList<short> >(customTypes);
|
||||||
|
+ registerHelper<QList<ushort> >(customTypes);
|
||||||
|
+ registerHelper<QList<int> >(customTypes);
|
||||||
|
+ registerHelper<QList<uint> >(customTypes);
|
||||||
|
+ registerHelper<QList<qlonglong> >(customTypes);
|
||||||
|
+ registerHelper<QList<qulonglong> >(customTypes);
|
||||||
|
+ registerHelper<QList<double> >(customTypes);
|
||||||
|
+ registerHelper<QList<QDBusObjectPath> >(customTypes);
|
||||||
|
+ registerHelper<QList<QDBusSignature> >(customTypes);
|
||||||
|
+ registerHelper<QList<QDBusUnixFileDescriptor> >(customTypes);
|
||||||
|
#endif
|
||||||
|
-
|
||||||
|
- initialized.store(true);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
-Q_GLOBAL_STATIC(QVector<QDBusCustomTypeInfo>, customTypes)
|
||||||
|
-Q_GLOBAL_STATIC(QReadWriteLock, customTypesLock)
|
||||||
|
-
|
||||||
|
/*!
|
||||||
|
\class QDBusMetaType
|
||||||
|
\inmodule QtDBus
|
||||||
|
@@ -203,14 +190,22 @@ void QDBusMetaType::registerMarshallOperators(int id, MarshallFunction mf,
|
||||||
|
DemarshallFunction df)
|
||||||
|
{
|
||||||
|
QByteArray var;
|
||||||
|
- QVector<QDBusCustomTypeInfo> *ct = customTypes();
|
||||||
|
- if (id < 0 || !mf || !df || !ct)
|
||||||
|
+ QDBusMetaTypeId *mgr = QDBusMetaTypeId::instance();
|
||||||
|
+ if (id < 0 || !mf || !df || !mgr)
|
||||||
|
return; // error!
|
||||||
|
|
||||||
|
- QWriteLocker locker(customTypesLock());
|
||||||
|
- if (id >= ct->size())
|
||||||
|
- ct->resize(id + 1);
|
||||||
|
- QDBusCustomTypeInfo &info = (*ct)[id];
|
||||||
|
+ QWriteLocker locker(&mgr->customTypesLock);
|
||||||
|
+ QVector<QDBusCustomTypeInfo> &ct = mgr->customTypes;
|
||||||
|
+ registerMarshallOperatorsNoLock(ct, id, mf, df);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void registerMarshallOperatorsNoLock(QVector<QDBusCustomTypeInfo> &ct, int id,
|
||||||
|
+ QDBusMetaType::MarshallFunction mf,
|
||||||
|
+ QDBusMetaType::DemarshallFunction df)
|
||||||
|
+{
|
||||||
|
+ if (id >= ct.size())
|
||||||
|
+ ct.resize(id + 1);
|
||||||
|
+ QDBusCustomTypeInfo &info = ct[id];
|
||||||
|
info.marshall = mf;
|
||||||
|
info.demarshall = df;
|
||||||
|
}
|
||||||
|
@@ -227,12 +222,16 @@ bool QDBusMetaType::marshall(QDBusArgument &arg, int id, const void *data)
|
||||||
|
|
||||||
|
MarshallFunction mf;
|
||||||
|
{
|
||||||
|
- QReadLocker locker(customTypesLock());
|
||||||
|
- QVector<QDBusCustomTypeInfo> *ct = customTypes();
|
||||||
|
- if (id >= ct->size())
|
||||||
|
+ const QDBusMetaTypeId *mgr = QDBusMetaTypeId::instance();
|
||||||
|
+ if (!mgr)
|
||||||
|
+ return false; // shutting down
|
||||||
|
+
|
||||||
|
+ QReadLocker locker(&mgr->customTypesLock);
|
||||||
|
+ const QVector<QDBusCustomTypeInfo> &ct = mgr->customTypes;
|
||||||
|
+ if (id >= ct.size())
|
||||||
|
return false; // non-existent
|
||||||
|
|
||||||
|
- const QDBusCustomTypeInfo &info = (*ct).at(id);
|
||||||
|
+ const QDBusCustomTypeInfo &info = ct.at(id);
|
||||||
|
if (!info.marshall) {
|
||||||
|
mf = 0; // make gcc happy
|
||||||
|
return false;
|
||||||
|
@@ -256,12 +255,16 @@ bool QDBusMetaType::demarshall(const QDBusArgument &arg, int id, void *data)
|
||||||
|
|
||||||
|
DemarshallFunction df;
|
||||||
|
{
|
||||||
|
- QReadLocker locker(customTypesLock());
|
||||||
|
- QVector<QDBusCustomTypeInfo> *ct = customTypes();
|
||||||
|
- if (id >= ct->size())
|
||||||
|
+ const QDBusMetaTypeId *mgr = QDBusMetaTypeId::instance();
|
||||||
|
+ if (!mgr)
|
||||||
|
+ return false; // shutting down
|
||||||
|
+
|
||||||
|
+ QReadLocker locker(&mgr->customTypesLock);
|
||||||
|
+ const QVector<QDBusCustomTypeInfo> &ct = mgr->customTypes;
|
||||||
|
+ if (id >= ct.size())
|
||||||
|
return false; // non-existent
|
||||||
|
|
||||||
|
- const QDBusCustomTypeInfo &info = (*ct).at(id);
|
||||||
|
+ const QDBusCustomTypeInfo &info = ct.at(id);
|
||||||
|
if (!info.demarshall) {
|
||||||
|
df = 0; // make gcc happy
|
||||||
|
return false;
|
||||||
|
@@ -420,7 +423,11 @@ const char *QDBusMetaType::typeToSignature(int type)
|
||||||
|
DBUS_TYPE_BYTE_AS_STRING; // ay
|
||||||
|
}
|
||||||
|
|
||||||
|
- QDBusMetaTypeId::init();
|
||||||
|
+ // try the database
|
||||||
|
+ QDBusMetaTypeId *mgr = QDBusMetaTypeId::instance();
|
||||||
|
+ if (!mgr)
|
||||||
|
+ return Q_NULLPTR; // shutting down
|
||||||
|
+
|
||||||
|
if (type == QDBusMetaTypeId::variant())
|
||||||
|
return DBUS_TYPE_VARIANT_AS_STRING;
|
||||||
|
else if (type == QDBusMetaTypeId::objectpath())
|
||||||
|
@@ -430,14 +437,13 @@ const char *QDBusMetaType::typeToSignature(int type)
|
||||||
|
else if (type == QDBusMetaTypeId::unixfd())
|
||||||
|
return DBUS_TYPE_UNIX_FD_AS_STRING;
|
||||||
|
|
||||||
|
- // try the database
|
||||||
|
- QVector<QDBusCustomTypeInfo> *ct = customTypes();
|
||||||
|
{
|
||||||
|
- QReadLocker locker(customTypesLock());
|
||||||
|
- if (type >= ct->size())
|
||||||
|
+ QReadLocker locker(&mgr->customTypesLock);
|
||||||
|
+ const QVector<QDBusCustomTypeInfo> &ct = mgr->customTypes;
|
||||||
|
+ if (type >= ct.size())
|
||||||
|
return 0; // type not registered with us
|
||||||
|
|
||||||
|
- const QDBusCustomTypeInfo &info = (*ct).at(type);
|
||||||
|
+ const QDBusCustomTypeInfo &info = ct.at(type);
|
||||||
|
|
||||||
|
if (!info.signature.isNull())
|
||||||
|
return info.signature;
|
||||||
|
@@ -454,8 +460,9 @@ const char *QDBusMetaType::typeToSignature(int type)
|
||||||
|
QByteArray signature = QDBusArgumentPrivate::createSignature(type);
|
||||||
|
|
||||||
|
// re-acquire lock
|
||||||
|
- QWriteLocker locker(customTypesLock());
|
||||||
|
- info = &(*ct)[type];
|
||||||
|
+ QWriteLocker locker(&mgr->customTypesLock);
|
||||||
|
+ QVector<QDBusCustomTypeInfo> &ct = mgr->customTypes;
|
||||||
|
+ info = &ct[type];
|
||||||
|
info->signature = signature;
|
||||||
|
}
|
||||||
|
return info->signature;
|
||||||
|
diff --git a/src/dbus/qdbusmetatype_p.h b/src/dbus/qdbusmetatype_p.h
|
||||||
|
index 348fc6c..24c8326 100644
|
||||||
|
--- a/src/dbus/qdbusmetatype_p.h
|
||||||
|
+++ b/src/dbus/qdbusmetatype_p.h
|
||||||
|
@@ -1,6 +1,7 @@
|
||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2016 The Qt Company Ltd.
|
||||||
|
+** Copyright (C) 2016 Intel Corporation.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the QtDBus module of the Qt Toolkit.
|
||||||
|
@@ -53,10 +54,27 @@
|
||||||
|
#include <qdbuserror.h>
|
||||||
|
#include <qdbusunixfiledescriptor.h>
|
||||||
|
|
||||||
|
+#include <qbytearray.h>
|
||||||
|
+#include <qreadwritelock.h>
|
||||||
|
+#include <qvector.h>
|
||||||
|
+
|
||||||
|
#ifndef QT_NO_DBUS
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
+class QDBusCustomTypeInfo
|
||||||
|
+{
|
||||||
|
+public:
|
||||||
|
+ QDBusCustomTypeInfo() : signature(), marshall(0), demarshall(0)
|
||||||
|
+ { }
|
||||||
|
+
|
||||||
|
+ // Suggestion:
|
||||||
|
+ // change 'signature' to char* and make QDBusCustomTypeInfo a Movable type
|
||||||
|
+ QByteArray signature;
|
||||||
|
+ QDBusMetaType::MarshallFunction marshall;
|
||||||
|
+ QDBusMetaType::DemarshallFunction demarshall;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct QDBusMetaTypeId
|
||||||
|
{
|
||||||
|
static int message(); // QDBusMessage
|
||||||
|
@@ -67,7 +85,14 @@ struct QDBusMetaTypeId
|
||||||
|
static int error(); // QDBusError
|
||||||
|
static int unixfd(); // QDBusUnixFileDescriptor
|
||||||
|
|
||||||
|
- static void init();
|
||||||
|
+ static void init() { instance(); }
|
||||||
|
+ static QDBusMetaTypeId *instance();
|
||||||
|
+
|
||||||
|
+ mutable QReadWriteLock customTypesLock;
|
||||||
|
+ QVector<QDBusCustomTypeInfo> customTypes;
|
||||||
|
+
|
||||||
|
+protected:
|
||||||
|
+ QDBusMetaTypeId();
|
||||||
|
};
|
||||||
|
|
||||||
|
inline int QDBusMetaTypeId::message()
|
||||||
|
diff --git a/src/dbus/qdbusmisc.cpp b/src/dbus/qdbusmisc.cpp
|
||||||
|
index ca33717..19ff676 100644
|
||||||
|
--- a/src/dbus/qdbusmisc.cpp
|
||||||
|
+++ b/src/dbus/qdbusmisc.cpp
|
||||||
|
@@ -132,8 +132,9 @@ int qDBusParametersForMethod(const QMetaMethod &mm, QVector<int> &metaTypes, QSt
|
||||||
|
|
||||||
|
int qDBusParametersForMethod(const QList<QByteArray> ¶meterTypes, QVector<int>& metaTypes, QString &errorMsg)
|
||||||
|
{
|
||||||
|
- QDBusMetaTypeId::init();
|
||||||
|
metaTypes.clear();
|
||||||
|
+ if (!QDBusMetaTypeId::instance())
|
||||||
|
+ return -1;
|
||||||
|
|
||||||
|
metaTypes.append(0); // return type
|
||||||
|
int inputCount = 0;
|
||||||
|
--
|
||||||
|
2.7.4
|
16
libqt5-prioritise-gtk2-platformtheme.patch
Normal file
16
libqt5-prioritise-gtk2-platformtheme.patch
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
|
||||||
|
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
|
||||||
|
@@ -766,9 +766,11 @@ QStringList QGenericUnixTheme::themeName
|
||||||
|
result.push_back(QLatin1String(QKdeTheme::name));
|
||||||
|
#endif
|
||||||
|
} else if (gtkBasedEnvironments.contains(desktopName)) {
|
||||||
|
- // prefer the GTK3 theme implementation with native dialogs etc.
|
||||||
|
+ // prefer the GTK+2 theme implementation with the native style, etc.
|
||||||
|
+ result.push_back(QStringLiteral("gtk2"));
|
||||||
|
+ // prefer second the GTK+3 theme implementation with native dialogs, etc.
|
||||||
|
result.push_back(QStringLiteral("gtk3"));
|
||||||
|
- // fallback to the generic Gnome theme if loading the GTK3 theme fails
|
||||||
|
+ // fallback to the generic GNOME theme if loading the GTK+3 theme fails
|
||||||
|
result.push_back(QLatin1String(QGnomeTheme::name));
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,19 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Oct 9 16:57:18 UTC 2016 - sor.alexei@meowr.ru
|
||||||
|
|
||||||
|
- Add libqt5-prioritise-gtk2-platformtheme.patch: Give
|
||||||
|
Gtk2 Platform Theme (from qtstyleplugins) a priority over
|
||||||
|
Gtk3 Platform Theme which currently lacks QGtk3Style
|
||||||
|
(boo#1002900).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Oct 9 16:49:29 UTC 2016 - hrvoje.senjan@gmail.com
|
||||||
|
|
||||||
|
- Add some QtDBus fixes from upstream:
|
||||||
|
Make-QDBusConnectionPrivaterelaySignal-be-called-in-the-right-thread.patch
|
||||||
|
Merge-the-QDBusMetaTypes-custom-information-to-QDBusConnectionManager.patch
|
||||||
|
Fix-some-QtDBus-crashes-during-application-destruction.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Sep 29 14:12:34 UTC 2016 - hrvoje.senjan@gmail.com
|
Thu Sep 29 14:12:34 UTC 2016 - hrvoje.senjan@gmail.com
|
||||||
|
|
||||||
@ -1262,4 +1278,3 @@ Fri Apr 13 13:22:38 UTC 2012 - stephan.binner@basyskom.com
|
|||||||
Thu Apr 5 09:56:15 UTC 2012 - dmueller@suse.com
|
Thu Apr 5 09:56:15 UTC 2012 - dmueller@suse.com
|
||||||
|
|
||||||
- Initial packaging (Qt 5.0 Alpha)
|
- Initial packaging (Qt 5.0 Alpha)
|
||||||
|
|
||||||
|
@ -54,12 +54,17 @@ Patch6: disable-rc4-ciphers-bnc865241.diff
|
|||||||
Patch7: tell-the-truth-about-private-api.patch
|
Patch7: tell-the-truth-about-private-api.patch
|
||||||
Patch8: xcb-Dont-activate-bypassed-windows-on-mouse-press.patch
|
Patch8: xcb-Dont-activate-bypassed-windows-on-mouse-press.patch
|
||||||
Patch9: Fix-unwanted-cache-flush-in-Freetype-engine.patch
|
Patch9: Fix-unwanted-cache-flush-in-Freetype-engine.patch
|
||||||
|
# PATCH-FIX-OPENSUSE libqt5-prioritise-gtk2-platformtheme.patch boo#1002900 -- Give Gtk2 Platform Theme (from qtstyleplugins) a priority over Gtk3 PT which currently lacks QGtk3Style.
|
||||||
|
Patch10: libqt5-prioritise-gtk2-platformtheme.patch
|
||||||
# patches 1000-2000 and above from upstream 5.7 branch #
|
# patches 1000-2000 and above from upstream 5.7 branch #
|
||||||
Patch1000: xcb-Send-also-text-plain-when-a-text-uri-list-is-dropped.patch
|
Patch1000: xcb-Send-also-text-plain-when-a-text-uri-list-is-dropped.patch
|
||||||
Patch1001: xcb-Dont-send-QtWindowNoState-event-when-hiding-minimized-window.patch
|
Patch1001: xcb-Dont-send-QtWindowNoState-event-when-hiding-minimized-window.patch
|
||||||
Patch1002: XCB-Drop-from-external-app-fix-keyboard-modifier-state.patch
|
Patch1002: XCB-Drop-from-external-app-fix-keyboard-modifier-state.patch
|
||||||
Patch1003: xcb-Use-the-state-of-the-key-event-to-process-it.patch
|
Patch1003: xcb-Use-the-state-of-the-key-event-to-process-it.patch
|
||||||
Patch1004: Stop-unloading-plugins-in-QPluginLoader-and-QFactoryLoader.patch
|
Patch1004: Stop-unloading-plugins-in-QPluginLoader-and-QFactoryLoader.patch
|
||||||
|
Patch1005: Make-QDBusConnectionPrivaterelaySignal-be-called-in-the-right-thread.patch
|
||||||
|
Patch1006: Merge-the-QDBusMetaTypes-custom-information-to-QDBusConnectionManager.patch
|
||||||
|
Patch1007: Fix-some-QtDBus-crashes-during-application-destruction.patch
|
||||||
# patches 2000-3000 and above from upstream 5.8 branch #
|
# patches 2000-3000 and above from upstream 5.8 branch #
|
||||||
BuildRequires: alsa-devel
|
BuildRequires: alsa-devel
|
||||||
BuildRequires: cups-devel
|
BuildRequires: cups-devel
|
||||||
@ -148,11 +153,15 @@ handling.
|
|||||||
%patch7 -p1
|
%patch7 -p1
|
||||||
%patch8 -p1
|
%patch8 -p1
|
||||||
%patch9 -p1
|
%patch9 -p1
|
||||||
|
%patch10 -p1
|
||||||
%patch1000 -p1
|
%patch1000 -p1
|
||||||
%patch1001 -p1
|
%patch1001 -p1
|
||||||
%patch1002 -p1
|
%patch1002 -p1
|
||||||
%patch1003 -p1
|
%patch1003 -p1
|
||||||
%patch1004 -p1
|
%patch1004 -p1
|
||||||
|
%patch1005 -p1
|
||||||
|
%patch1006 -p1
|
||||||
|
%patch1007 -p1
|
||||||
|
|
||||||
# be sure not to use them
|
# be sure not to use them
|
||||||
rm -rf src/3rdparty/{libjpeg,freetype,zlib}
|
rm -rf src/3rdparty/{libjpeg,freetype,zlib}
|
||||||
@ -487,7 +496,7 @@ Recommends: libqt5-qtimageformats = %{version}
|
|||||||
Requires: libQt5Core5 = %{version}
|
Requires: libQt5Core5 = %{version}
|
||||||
Requires: libQt5DBus5 = %{version}
|
Requires: libQt5DBus5 = %{version}
|
||||||
Provides: libqt5-qtbase-platformtheme-gtk2 = %{version}
|
Provides: libqt5-qtbase-platformtheme-gtk2 = %{version}
|
||||||
Obsoletes: libqt5-qtbase-platformtheme-gtk2 <= %{version}
|
Obsoletes: libqt5-qtbase-platformtheme-gtk2 < %{version}
|
||||||
|
|
||||||
%description -n libQt5Gui5
|
%description -n libQt5Gui5
|
||||||
Qt 5 libraries which are depending on X11.
|
Qt 5 libraries which are depending on X11.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user