1
0
forked from pool/libqt5-qtbase
Dominique Leuenberger 2017-06-13 14:06:00 +00:00 committed by Git OBS Bridge
parent bea8c543d0
commit a0119ff1d2
14 changed files with 763 additions and 694 deletions

View File

@ -0,0 +1,292 @@
From d3faa880d19d9bf5b411dc81c0d5d881a323997d Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <larrosa@kde.org>
Date: Tue, 6 Jun 2017 16:34:32 +0200
Subject: [PATCH] Add remote print queue support
Cups servers which announce themselves on avahi will be shown in
the printer dialog. This adds a delay the first time the print dialog
is opened in order to search for print queues . If you don't have any
network printer queue and you find the delay too annoying, it can be
disabled by setting the QT_DISABLE_PRINTER_DISCOVERY environment variable
to 1
Change-Id: Ib70715d331e8f380a3c9039011bb8521986652aa
---
src/plugins/printsupport/cups/qcupsprintengine.cpp | 35 +++++++-
.../printsupport/cups/qcupsprintersupport.cpp | 95 ++++++++++++++++++++--
.../printsupport/cups/qcupsprintersupport_p.h | 8 ++
src/plugins/printsupport/cups/qppdprintdevice.cpp | 33 +++++++-
4 files changed, 160 insertions(+), 11 deletions(-)
diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp
index a16eb3abb5..6dc123fb51 100644
--- a/src/plugins/printsupport/cups/qcupsprintengine.cpp
+++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp
@@ -48,6 +48,7 @@
#include <qbuffer.h>
#include "private/qcups_p.h" // Only needed for PPK_CupsOptions
#include <QtGui/qpagelayout.h>
+#include "qcupsprintersupport_p.h"
#include <cups/cups.h>
@@ -241,8 +242,40 @@ void QCupsPrintEnginePrivate::closePrintDevice()
// Print the file.
cups_option_t* optPtr = cupsOptStruct.size() ? &cupsOptStruct.first() : 0;
- cupsPrintFile(printerName.toLocal8Bit().constData(), tempFile.toLocal8Bit().constData(),
+
+ bool fallbackToLocal = false;
+ cups_dest_t *cupsDest = NULL;
+
+ if (qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY")) {
+ fallbackToLocal = true;
+ } else {
+ cupsDest = cupsGetDest(printerName.toLocal8Bit(), NULL, QCupsPrinterSupport::cupsPrintersCount(), QCupsPrinterSupport::cupsPrinters());
+ }
+
+ if (cupsDest) {
+ char resource[HTTP_MAX_URI];
+ http_t *http = cupsConnectDest (cupsDest, 0, -1, 0,
+ resource, sizeof (resource),
+ 0, 0);
+ if (http) {
+ char *name = strrchr (resource, '/');
+ qDebug() << "resource:" << resource << "," << name;
+ if (name)
+ cupsPrintFile2 (http, ++name, tempFile.toLocal8Bit().constData(),
title.toLocal8Bit().constData(), cupsOptStruct.size(), optPtr);
+ httpClose(http);
+ } else {
+ fallbackToLocal=true;
+ }
+ }
+ else {
+ fallbackToLocal=true;
+ }
+
+ if (fallbackToLocal) {
+ cupsPrintFile(printerName.toLocal8Bit().constData(), tempFile.toLocal8Bit().constData(),
+ title.toLocal8Bit().constData(), cupsOptStruct.size(), optPtr);
+ }
QFile::remove(tempFile);
}
diff --git a/src/plugins/printsupport/cups/qcupsprintersupport.cpp b/src/plugins/printsupport/cups/qcupsprintersupport.cpp
index 1887625406..a145beaf18 100644
--- a/src/plugins/printsupport/cups/qcupsprintersupport.cpp
+++ b/src/plugins/printsupport/cups/qcupsprintersupport.cpp
@@ -52,6 +52,35 @@
# include <cups/language.h>
#endif
+typedef struct
+{
+ cups_dest_t *printers;
+ int num_printers;
+} EnumDestsContext;
+
+static int enum_dest_cb2 (void *user_data, unsigned flags, cups_dest_t *dest)
+{
+ EnumDestsContext *context = (EnumDestsContext *) user_data;
+ if ((flags & (CUPS_DEST_FLAGS_UNCONNECTED |
+ CUPS_DEST_FLAGS_REMOVED |
+ CUPS_DEST_FLAGS_ERROR |
+ CUPS_DEST_FLAGS_RESOLVING |
+ CUPS_DEST_FLAGS_CONNECTING |
+ CUPS_DEST_FLAGS_CANCELED)) == 0) {
+
+ context->num_printers = cupsCopyDest (dest, context->num_printers,
+ &context->printers);
+
+ // Also copy whether this is the local default /
+ cups_dest_t *the_dest;
+ the_dest = cupsGetDest(dest->name, dest->instance,
+ context->num_printers, context->printers);
+ the_dest->is_default = dest->is_default;
+ qDebug() << dest->name << "_" << dest->instance << "_" << context->num_printers;
+ }
+ return 1;
+}
+
QT_BEGIN_NAMESPACE
QCupsPrinterSupport::QCupsPrinterSupport()
@@ -81,17 +110,35 @@ QPrintDevice QCupsPrinterSupport::createPrintDevice(const QString &id)
QStringList QCupsPrinterSupport::availablePrintDeviceIds() const
{
- QStringList list;
+/* // Reset cache disabled for now
+ if (qt_cups_printers) {
+ cupsFreeDests( qt_cups_num_printers, qt_cups_printers );
+ qt_cups_printers = NULL;
+ qt_cups_num_printers = 0;
+ }
+*/
cups_dest_t *dests;
- int count = cupsGetDests(&dests);
- list.reserve(count);
- for (int i = 0; i < count; ++i) {
+ bool disablePrinterDiscovery = qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY");
+ if (disablePrinterDiscovery) {
+ qt_cups_num_printers = cupsGetDests(&dests);
+ } else {
+ if (qt_cups_num_printers == 0)
+ QCupsPrinterSupport::fillCupsPrinters();
+
+ dests = qt_cups_printers;
+ }
+ QStringList list;
+ list.reserve(qt_cups_num_printers);
+ for (int i = 0; i < qt_cups_num_printers; ++i) {
QString printerId = QString::fromLocal8Bit(dests[i].name);
if (dests[i].instance)
printerId += QLatin1Char('/') + QString::fromLocal8Bit(dests[i].instance);
list.append(printerId);
}
- cupsFreeDests(count, dests);
+ if (disablePrinterDiscovery) {
+ cupsFreeDests(qt_cups_num_printers, dests);
+ }
+
return list;
}
@@ -99,8 +146,18 @@ QString QCupsPrinterSupport::defaultPrintDeviceId() const
{
QString printerId;
cups_dest_t *dests;
- int count = cupsGetDests(&dests);
- for (int i = 0; i < count; ++i) {
+
+ bool disablePrinterDiscovery = qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY");
+ if (disablePrinterDiscovery) {
+ qt_cups_num_printers = cupsGetDests(&dests);
+ } else {
+ if (qt_cups_num_printers == 0)
+ QCupsPrinterSupport::fillCupsPrinters();
+
+ dests = qt_cups_printers;
+ }
+
+ for (int i = 0; i < qt_cups_num_printers; ++i) {
if (dests[i].is_default) {
printerId = QString::fromLocal8Bit(dests[i].name);
if (dests[i].instance) {
@@ -109,8 +166,30 @@ QString QCupsPrinterSupport::defaultPrintDeviceId() const
}
}
}
- cupsFreeDests(count, dests);
+ if (disablePrinterDiscovery) {
+ cupsFreeDests(qt_cups_num_printers, dests);
+ }
return printerId;
}
+void QCupsPrinterSupport::fillCupsPrinters()
+{
+ EnumDestsContext context;
+ context.printers = 0;
+ context.num_printers = 0;
+
+ qDebug() << "begin enumerating printers";
+
+ cupsEnumDests(CUPS_DEST_FLAGS_NONE, 4000, NULL, 0, 0,
+ enum_dest_cb2, &context);
+
+ qDebug() << "end enumerating printers";
+ qt_cups_printers = context.printers;
+ qt_cups_num_printers = context.num_printers;
+}
+
+cups_dest_t *QCupsPrinterSupport::qt_cups_printers = NULL;
+int QCupsPrinterSupport::qt_cups_num_printers = 0;
+
+
QT_END_NAMESPACE
diff --git a/src/plugins/printsupport/cups/qcupsprintersupport_p.h b/src/plugins/printsupport/cups/qcupsprintersupport_p.h
index 13f64b5e69..81eaa09882 100644
--- a/src/plugins/printsupport/cups/qcupsprintersupport_p.h
+++ b/src/plugins/printsupport/cups/qcupsprintersupport_p.h
@@ -56,6 +56,8 @@
#include <QtCore/qstringlist.h>
+#include <cups/cups.h>
+
QT_BEGIN_NAMESPACE
class QCupsPrinterSupport : public QPlatformPrinterSupport
@@ -71,8 +73,14 @@ public:
QStringList availablePrintDeviceIds() const Q_DECL_OVERRIDE;
QString defaultPrintDeviceId() const Q_DECL_OVERRIDE;
+ static void fillCupsPrinters();
+ static cups_dest_t *cupsPrinters() { return qt_cups_printers; };
+ static int cupsPrintersCount() { return qt_cups_num_printers; };
private:
QString cupsOption(int i, const QString &key) const;
+
+ static cups_dest_t *qt_cups_printers;
+ static int qt_cups_num_printers;
};
QT_END_NAMESPACE
diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp
index 9efa83d409..5b7222902d 100644
--- a/src/plugins/printsupport/cups/qppdprintdevice.cpp
+++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp
@@ -41,6 +41,7 @@
#include <QtCore/QMimeDatabase>
#include <qdebug.h>
+#include "qcupsprintersupport_p.h"
#ifndef QT_LINUXBASE // LSB merges everything into cups.h
#include <cups/language.h>
@@ -451,10 +452,38 @@ void QPpdPrintDevice::loadPrinter()
m_cupsDest = 0;
}
+ bool disablePrinterDiscovery = qEnvironmentVariableIsSet("QT_DISABLE_PRINTER_DISCOVERY");
+
// Get the print instance and PPD file
- m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance);
+
+ if (disablePrinterDiscovery) {
+ m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance);
+ } else {
+ cups_dest_t *cupsDest = cupsGetDest( m_cupsName,
+ (m_cupsInstance.isEmpty() ? NULL : m_cupsInstance.data()),
+ QCupsPrinterSupport::cupsPrintersCount(),
+ QCupsPrinterSupport::cupsPrinters() );
+ cupsCopyDest(cupsDest, 0, &m_cupsDest);
+ }
if (m_cupsDest) {
- const char *ppdFile = cupsGetPPD(m_cupsName);
+ char resource[HTTP_MAX_URI];
+ http_t *http = NULL;
+ const char *ppdFile = NULL;
+
+ if (!disablePrinterDiscovery) {
+ http = cupsConnectDest (m_cupsDest, 0, -1, 0,
+ resource, sizeof (resource),
+ 0, 0);
+ }
+ if (http) {
+ char *name = strrchr (resource, '/');
+ if (name)
+ ppdFile = cupsGetPPD2 (http, ++name);
+ httpClose(http);
+ } else {
+ ppdFile = cupsGetPPD(m_cupsName);
+ }
+
if (ppdFile) {
m_ppd = ppdOpenFile(ppdFile);
unlink(ppdFile);
--
2.13.0

View File

@ -0,0 +1,33 @@
From e840a7ed21bc8e93e2e87fec25dd98aa0039fca1 Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <larrosa@kde.org>
Date: Tue, 18 Apr 2017 17:56:35 +0200
Subject: [PATCH] Fix open/chmod race condition in QSaveFile
This fixes a problem introduced in a60571b3700e80f44705ebc4bab9628cf852891c
by which a temporary file could be created with mode 0666 (0644 after
applying umask), and then changed to 0600, but in the meantime it would
be possible for anyone to get a working file descriptor that could be used
to read the file. See https://bugzilla.suse.com/show_bug.cgi?id=1034005.
Change-Id: I824025f54d6faf853da88e4dfcb092b577b4df04
---
src/corelib/io/qsavefile.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp
index 5a325f8e2c..af90b96d82 100644
--- a/src/corelib/io/qsavefile.cpp
+++ b/src/corelib/io/qsavefile.cpp
@@ -216,7 +216,8 @@ bool QSaveFile::open(OpenMode mode)
}
d->fileEngine = new QTemporaryFileEngine;
- static_cast<QTemporaryFileEngine *>(d->fileEngine)->initialize(d->finalFileName, 0666);
+ int perm = (existingFile.exists() ? 0600 : 0666);
+ static_cast<QTemporaryFileEngine *>(d->fileEngine)->initialize(d->finalFileName, perm);
// Same as in QFile: QIODevice provides the buffering, so there's no need to request it from the file engine.
if (!d->fileEngine->open(mode | QIODevice::Unbuffered)) {
QFileDevice::FileError err = d->fileEngine->error();
--
2.12.2

View File

@ -1,120 +0,0 @@
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

View File

@ -1,428 +0,0 @@
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> &parameterTypes, 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

View File

@ -1,78 +0,0 @@
From 8081ab4938b192bb740c5ee3004468aa6840563d Mon Sep 17 00:00:00 2001
From: Thiago Macieira <thiago.macieira@intel.com>
Date: Thu, 12 Nov 2015 10:14:51 -0800
Subject: [PATCH] Stop unloading plugins in QPluginLoader and QFactoryLoader
QPluginLoader hasn't unloaded in its destructor since Qt 5.0, but we
missed the equivalent code in QFactoryLoader (which bypasses
QPluginLoader). Besides, QPluginLoader::unload() was still doing
unloading, which it won't anymore.
Not unloading plugins is Qt's policy, as decided during the 5.0
development process and reaffirmed now in 5.6. This is due to static
data in plugins leaking out and remaining in use past the unloading of
the plugin, causing crashes.
This does not affect QLibrary and QLibrary::unload(). Those are meant
for non-Qt loadable modules, so unloading them may be safe.
Task-number: QTBUG-49061
Task-number: QTBUG-52988
Discussed-on: http://lists.qt-project.org/pipermail/development/2015-November/023681.html
Change-Id: I6b3a1770e6c79cc4485a28ab286e069b88a149e5
---
src/corelib/plugin/qfactoryloader.cpp | 6 ++++--
src/corelib/plugin/qpluginloader.cpp | 5 +++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp
index dcf1b1a..b6558f5 100644
--- a/src/corelib/plugin/qfactoryloader.cpp
+++ b/src/corelib/plugin/qfactoryloader.cpp
@@ -208,10 +208,12 @@ void QFactoryLoader::update()
++keyUsageCount;
}
}
- if (keyUsageCount || keys.isEmpty())
+ if (keyUsageCount || keys.isEmpty()) {
+ library->setLoadHints(QLibrary::PreventUnloadHint); // once loaded, don't unload
d->libraryList += library;
- else
+ } else {
library->release();
+ }
}
}
#else
diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp
index 37f2368..0ea8280 100644
--- a/src/corelib/plugin/qpluginloader.cpp
+++ b/src/corelib/plugin/qpluginloader.cpp
@@ -148,6 +148,7 @@ QPluginLoader::QPluginLoader(const QString &fileName, QObject *parent)
: QObject(parent), d(0), did_load(false)
{
setFileName(fileName);
+ setLoadHints(QLibrary::PreventUnloadHint);
}
/*!
@@ -342,7 +343,7 @@ static QString locatePlugin(const QString& fileName)
void QPluginLoader::setFileName(const QString &fileName)
{
#if defined(QT_SHARED)
- QLibrary::LoadHints lh;
+ QLibrary::LoadHints lh = QLibrary::PreventUnloadHint;
if (d) {
lh = d->loadHints();
d->release();
@@ -391,7 +392,7 @@ Q_GLOBAL_STATIC(StaticPluginList, staticPluginList)
\brief Give the load() function some hints on how it should behave.
You can give hints on how the symbols in the plugin are
- resolved. By default, none of the hints are set.
+ resolved. By default since Qt 5.7, QLibrary::PreventUnloadHint is set.
See the documentation of QLibrary::loadHints for a complete
description of how this property works.
--
2.7.4

View File

@ -0,0 +1,105 @@
From de63bbd2f806b0219a60775017899cedb121581f Mon Sep 17 00:00:00 2001
From: Alexander Volkov <a.volkov@rusbitech.ru>
Date: Wed, 9 Nov 2016 17:33:00 +0300
Subject: [PATCH] Add QPlatformTheme::standardButtonShortcut()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It allows to set shortcuts for the standard buttons in
QDialogButtonBox.
Restore Qt4's behavior for the "Don't Save" button on macOS
by setting a shortcut for it (it was Cmd-D before Lion,
now it's Cmd-Delete).
Change-Id: I6b56f68f37670962178693a8983d9fe550540856
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
---
src/gui/kernel/qplatformtheme.cpp | 13 +++++++++++++
src/gui/kernel/qplatformtheme.h | 1 +
src/plugins/platforms/cocoa/qcocoatheme.h | 1 +
src/plugins/platforms/cocoa/qcocoatheme.mm | 6 ++++++
src/widgets/widgets/qdialogbuttonbox.cpp | 7 +------
5 files changed, 22 insertions(+), 6 deletions(-)
Index: qtbase-opensource-src-5.9.0/src/gui/kernel/qplatformtheme.cpp
===================================================================
--- qtbase-opensource-src-5.9.0.orig/src/gui/kernel/qplatformtheme.cpp
+++ qtbase-opensource-src-5.9.0/src/gui/kernel/qplatformtheme.cpp
@@ -678,19 +678,6 @@ QString QPlatformTheme::standardButtonTe
return QPlatformTheme::defaultStandardButtonText(button);
}
-/*!
- Returns the mnemonic that should be used for a standard \a button.
-
- \since 5.9
- \sa QPlatformDialogHelper::StandardButton
- */
-
-QKeySequence QPlatformTheme::standardButtonShortcut(int button) const
-{
- Q_UNUSED(button)
- return QKeySequence();
-}
-
QString QPlatformTheme::defaultStandardButtonText(int button)
{
switch (button) {
Index: qtbase-opensource-src-5.9.0/src/gui/kernel/qplatformtheme.h
===================================================================
--- qtbase-opensource-src-5.9.0.orig/src/gui/kernel/qplatformtheme.h
+++ qtbase-opensource-src-5.9.0/src/gui/kernel/qplatformtheme.h
@@ -312,7 +312,6 @@ public:
#endif
virtual QString standardButtonText(int button) const;
- virtual QKeySequence standardButtonShortcut(int button) const;
static QVariant defaultThemeHint(ThemeHint hint);
static QString defaultStandardButtonText(int button);
Index: qtbase-opensource-src-5.9.0/src/plugins/platforms/cocoa/qcocoatheme.h
===================================================================
--- qtbase-opensource-src-5.9.0.orig/src/plugins/platforms/cocoa/qcocoatheme.h
+++ qtbase-opensource-src-5.9.0/src/plugins/platforms/cocoa/qcocoatheme.h
@@ -74,7 +74,6 @@ public:
QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
QString standardButtonText(int button) const Q_DECL_OVERRIDE;
- QKeySequence standardButtonShortcut(int button) const Q_DECL_OVERRIDE;
static const char *name;
Index: qtbase-opensource-src-5.9.0/src/plugins/platforms/cocoa/qcocoatheme.mm
===================================================================
--- qtbase-opensource-src-5.9.0.orig/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ qtbase-opensource-src-5.9.0/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -344,12 +344,6 @@ QString QCocoaTheme::standardButtonText(
return button == QPlatformDialogHelper::Discard ? msgDialogButtonDiscard() : QPlatformTheme::standardButtonText(button);
}
-QKeySequence QCocoaTheme::standardButtonShortcut(int button) const
-{
- return button == QPlatformDialogHelper::Discard ? QKeySequence(Qt::CTRL | Qt::Key_Delete)
- : QPlatformTheme::standardButtonShortcut(button);
-}
-
QPlatformMenuItem *QCocoaTheme::createPlatformMenuItem() const
{
return new QCocoaMenuItem();
Index: qtbase-opensource-src-5.9.0/src/widgets/widgets/qdialogbuttonbox.cpp
===================================================================
--- qtbase-opensource-src-5.9.0.orig/src/widgets/widgets/qdialogbuttonbox.cpp
+++ qtbase-opensource-src-5.9.0/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -410,9 +410,7 @@ QPushButton *QDialogButtonBoxPrivate::cr
qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added");
else
addButton(button, static_cast<QDialogButtonBox::ButtonRole>(role), doLayout);
-#if QT_CONFIG(shortcut)
- button->setShortcut(QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton));
-#endif
+
return button;
}

View File

@ -0,0 +1,100 @@
From 32390f49291308eb85dcbcaa898bbf825a2eb229 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Tor=20Arne=20Vestb=C3=B8?= <tor.arne.vestbo@qt.io>
Date: Fri, 2 Jun 2017 11:09:55 +0200
Subject: [PATCH] xcb: Don't destroy foreign windows
We can't rely on virtual dispatch in the destructor.
Task-number: QTBUG-61140
Change-Id: Ib1026caf126095778c24254775cb5a0bfecf3a38
---
src/plugins/platforms/xcb/qxcbintegration.cpp | 18 +-----------------
src/plugins/platforms/xcb/qxcbwindow.cpp | 16 ++++++++++------
src/plugins/platforms/xcb/qxcbwindow.h | 12 ++++++++++++
3 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index b414bee..8e3ee20 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -214,25 +214,9 @@ QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const
return xcbWindow;
}
-class QXcbForeignWindow : public QXcbWindow
-{
-public:
- QXcbForeignWindow(QWindow *window, WId nativeHandle)
- : QXcbWindow(window) { m_window = nativeHandle; }
- ~QXcbForeignWindow() {}
- bool isForeignWindow() const override { return true; }
-
-protected:
- // No-ops
- void create() override {}
- void destroy() override {}
-};
-
QPlatformWindow *QXcbIntegration::createForeignWindow(QWindow *window, WId nativeHandle) const
{
- QXcbWindow *xcbWindow = new QXcbForeignWindow(window, nativeHandle);
- xcbWindow->create();
- return xcbWindow;
+ return new QXcbForeignWindow(window, nativeHandle);
}
#ifndef QT_NO_OPENGL
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 289d072..d6c69d5 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -597,13 +597,17 @@ QXcbWindow::~QXcbWindow()
}
destroy();
+}
- if (isForeignWindow()) {
- if (connection()->mouseGrabber() == this)
- connection()->setMouseGrabber(Q_NULLPTR);
- if (connection()->mousePressWindow() == this)
- connection()->setMousePressWindow(Q_NULLPTR);
- }
+QXcbForeignWindow::~QXcbForeignWindow()
+{
+ // Clear window so that destroy() does not affect it
+ m_window = 0;
+
+ if (connection()->mouseGrabber() == this)
+ connection()->setMouseGrabber(nullptr);
+ if (connection()->mousePressWindow() == this)
+ connection()->setMousePressWindow(nullptr);
}
void QXcbWindow::destroy()
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 5662809..f38343b 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -278,6 +278,18 @@ protected:
xcb_cursor_t m_currentBitmapCursor = XCB_CURSOR_NONE;
};
+class QXcbForeignWindow : public QXcbWindow
+{
+public:
+ QXcbForeignWindow(QWindow *window, WId nativeHandle)
+ : QXcbWindow(window) { m_window = nativeHandle; }
+ ~QXcbForeignWindow();
+ bool isForeignWindow() const override { return true; }
+
+protected:
+ void create() override {} // No-op
+};
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QXcbWindow*)
--
2.7.4

View File

@ -9,8 +9,7 @@
+ 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
// fallback to the generic Gnome theme if loading the GTK3 theme fails
result.push_back(QLatin1String(QGnomeTheme::name));
}
}
} else {
// unknown, but lowercase the name (our standard practice) and

View File

@ -1,3 +1,62 @@
-------------------------------------------------------------------
Tue Jun 6 10:19:48 UTC 2017 - alarrosa@suse.com
- Add 0001-Add-remote-print-queue-support.patch to support remote print
queues. This adds a delay the first time the print dialog is opened in
order to search for print queues. If you don't have any network printer
queue and you find the delay too annoying, it can be disabled by setting
the QT_DISABLE_PRINTER_DISCOVERY environment variable to 1 (fate#322052,
bsc#955432).
- Add 0001-Fix-open-chmod-race-condition-in-QSaveFile.patch to fix
a potential info leak due to race condition in QSaveFile (bsc#1034005).
-------------------------------------------------------------------
Fri Jun 2 21:11:41 UTC 2017 - fabian@ritter-vogt.de
- Revert upstream commit to workaround QTBUG-61197:
* de63bbd2f806b0219a60775017899cedb121581f.patch
-------------------------------------------------------------------
Fri Jun 2 17:57:54 UTC 2017 - fabian@ritter-vogt.de
- Add upstream patch to fix QTBUG-61140:
* dont-destroy-foreign-windows.patch
- Replaces c585802e946d97e7d177ea334a162dc7bc286b84.patch
-------------------------------------------------------------------
Fri Jun 2 08:49:53 UTC 2017 - fabian@ritter-vogt.de
- Add upstream patch to fix various HiDPI-related issues:
* native-children-hidpi-offset.patch (QTBUG-59017, kde#363548)
-------------------------------------------------------------------
Wed May 31 19:46:07 UTC 2017 - fabian@ritter-vogt.de
- Revert upstream commit to workaround QTBUG-61140:
c585802e946d97e7d177ea334a162dc7bc286b84.patch
-------------------------------------------------------------------
Wed May 31 07:05:05 UTC 2017 - fabian@ritter-vogt.de
- Update to 5.9.0 final
-------------------------------------------------------------------
Wed May 24 19:16:41 UTC 2017 - fabian@ritter-vogt.de
- Update to 5.9.0 RC:
* For more details please see:
http://lists.qt-project.org/pipermail/announce/2017-May/000115.html
and https://wiki.qt.io/New_Features_in_Qt_5.9
- Remove patches, now upstream:
* Stop-unloading-plugins-in-QPluginLoader-and-QFactoryLoader.patch
* Fix-some-QtDBus-crashes-during-application-destruction.patch
* Merge-the-QDBusMetaTypes-custom-information-to-QDBusConnectionManager.patch
- Refresh patches:
* Fix-some-QtDBus-crashes-during-application-destruction.patch
* Merge-the-QDBusMetaTypes-custom-information-to-QDBusConnectionManager.patch
* libqt5-prioritise-gtk2-platformtheme.patch
* tell-the-truth-about-private-api.patch
-------------------------------------------------------------------
Wed Dec 14 16:05:44 UTC 2016 - hrvoje.senjan@gmail.com

View File

@ -1,7 +1,7 @@
#
# spec file for package libqt5-qtbase
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -26,17 +26,17 @@
%endif
Name: libqt5-qtbase
Version: 5.7.1
Version: 5.9.0
Release: 0
Summary: C++ Program Library, Core Components
License: GPL-3.0 or SUSE-LGPL-2.1-with-digia-exception-1.1
Group: System/Libraries
Url: http://qt.digia.com
Url: https://www.qt.io
%define base_name libqt5
%define real_version 5.7.1
%define so_version 5.7.1
%define real_version 5.9.0
%define so_version 5.9.0
%define tar_version qtbase-opensource-src-%{real_version}
Source: %{tar_version}.tar.xz
Source: https://download.qt.io/official_releases/qt/5.9/%{real_version}/submodules/%{tar_version}.tar.xz
# to get mtime of file:
Source1: libqt5-qtbase.changes
Source2: macros.qt5
@ -49,14 +49,21 @@ Patch3: libqt5-Fix-Gujarati-font.patch
Patch5: libqt5-do-not-use-shm-if-display-name-doesnt-look-local.patch
# PATCH-FIX-OPENSUSE disable-rc4-ciphers-bnc865241.diff bnc#865241-- Exclude rc4 ciphers from being used by default
Patch6: disable-rc4-ciphers-bnc865241.diff
Patch7: tell-the-truth-about-private-api.patch
Patch8: tell-the-truth-about-private-api.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 #
Patch1004: Stop-unloading-plugins-in-QPluginLoader-and-QFactoryLoader.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 #
# PATCH-FIX-OPENSUSE de63bbd2f806b0219a60775017899cedb121581f.patch -- Revert upstream commit to workaround QTBUG-61197
Patch11: de63bbd2f806b0219a60775017899cedb121581f.patch
# PATCH-FEATURE-OPENSUSE 0001-Add-remote-print-queue-support.patch fate#322052 -- Automatically recognize and allow printing to remote cups servers
Patch12: 0001-Add-remote-print-queue-support.patch
# PATCH-FIX-UPSTREAM 0001-Fix-open-chmod-race-condition-in-QSaveFile.patch bsc#1034005 -- Fix a open file/change permission race condition in QSaveFile
Patch13: 0001-Fix-open-chmod-race-condition-in-QSaveFile.patch
# patches 1000-2000 and above from upstream 5.9 branch #
# PATCH-FIX-UPSTREAM
Patch1000: native-children-hidpi-offset.patch
# PATCH-FIX-UPSTREAM Revert to workaround QTBUG-61140
Patch1001: dont-destroy-foreign-windows.patch
# patches 2000-3000 and above from upstream 5.10/dev branch #
BuildRequires: alsa-devel
BuildRequires: cups-devel
BuildRequires: double-conversion-devel
@ -140,11 +147,13 @@ handling.
%patch3 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch10 -p1
%patch1004 -p1
%patch1006 -p1
%patch1007 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch1000 -p1
%patch1001 -p1
# be sure not to use them
rm -rf src/3rdparty/{libjpeg,freetype,zlib}
@ -564,6 +573,7 @@ Requires: %{name}-devel = %{version}
Requires: libQt5Core-private-headers-devel = %{version}
Requires: libQt5DBus-private-headers-devel = %{version}
Requires: libQt5Gui-private-headers-devel = %{version}
Requires: libQt5KmsSupport-private-headers-devel = %{version}
Requires: libQt5Network-private-headers-devel = %{version}
Requires: libQt5OpenGL-private-headers-devel = %{version}
Requires: libQt5PlatformSupport-private-headers-devel = %{version}
@ -634,6 +644,26 @@ Requires: libQt5PlatformSupport-devel-static = %{version}
%description -n libQt5PlatformSupport-private-headers-devel
Qt 5 PlatformSupport Library - Non-ABI stable development files.
%package -n libQt5KmsSupport-devel-static
Summary: Qt KmsSupport module
Group: Development/Libraries/C and C++
Requires: libQt5Core-devel = %{version}
Requires: libQt5Gui-devel = %{version}
%description -n libQt5KmsSupport-devel-static
Qt KmsSupport module.
%package -n libQt5KmsSupport-private-headers-devel
Summary: Qt 5 KmsSupport Library - Non-ABI stable development files
Group: Development/Libraries/X11
BuildArch: noarch
Requires: libQt5Core-private-headers-devel = %{version}
Requires: libQt5Gui-private-headers-devel = %{version}
Requires: libQt5KmsSupport-devel-static = %{version}
%description -n libQt5KmsSupport-private-headers-devel
Qt 5 KmsSupport Library - Non-ABI stable development files.
%package -n libQt5PlatformHeaders-devel
Summary: Qt 5 PlatformHeaders
Group: Development/Libraries/X11
@ -661,7 +691,7 @@ Recommends: libqt5-qtbase-devel
Examples for libqt5-qtbase modules.
%build
export QMAKESPEC=$PWD/mkspecs/linux-g++
#export QMAKESPEC=$PWD/mkspecs/linux-g++
%ifarch ppc64
RPM_OPT_FLAGS="%{optflags} -mminimal-toc"
%endif
@ -716,11 +746,7 @@ echo yes | ./configure $platform \
-shared \
-xkb \
-system-xkbcommon \
-xrender \
-xcursor \
-dbus-linked \
-xfixes \
-xrandr \
-sm \
-no-rpath \
-system-libjpeg \
@ -733,7 +759,6 @@ echo yes | ./configure $platform \
-system-freetype \
-cups \
-system-zlib \
-iconv \
-no-pch \
-glib \
-system-sqlite \
@ -742,7 +767,6 @@ echo yes | ./configure $platform \
%if %journald
-journald \
%endif
-xsync \
-xcb \
-egl \
-eglfs \
@ -785,7 +809,7 @@ find %{buildroot}%{libqt5_libdir} -type f -name '*pc' -print -exec perl -pi -e "
find %{buildroot}%{libqt5_libdir}/ -name 'lib*.a' -exec chmod -x -- {} \;
# kill .la files
rm -fv %{buildroot}%{libqt5_libdir}/lib*.la
rm -fv %{buildroot}%{libqt5_libdir}/libqtpng.*
rm -fv %{buildroot}%{libqt5_libdir}/*png.*
#
rm -fv %{buildroot}%{libqt5_libdir}/cmake/Qt5*/Q*Plugin.cmake
@ -1035,7 +1059,7 @@ popd
%ifarch %ix86
%{libqt5_libdir}/sse2/libQt5Gui.so.*
%endif
%{libqt5_libdir}/libQt5EglDeviceIntegration.so.*
%{libqt5_libdir}/libQt5EglFSDeviceIntegration.so.*
%if 0%{?is_opensuse}
%{libqt5_libdir}/libQt5EglFsKmsSupport.so.*
%endif
@ -1058,6 +1082,8 @@ popd
%doc *.txt LICENSE.*
%{libqt5_libdir}/libQt5Gui.so
%{libqt5_libdir}/libQt5Gui.prl
%{libqt5_libdir}/libQt5EglFSDeviceIntegration.so
%{libqt5_libdir}/libQt5EglFSDeviceIntegration.prl
%if 0%{?is_opensuse}
%{libqt5_libdir}/libQt5EglFsKmsSupport.prl
%{libqt5_libdir}/libQt5EglFsKmsSupport.so
@ -1065,7 +1091,9 @@ popd
%{libqt5_libdir}/cmake/Qt5Gui/
%{libqt5_libdir}/pkgconfig/Qt5Gui.pc
%{libqt5_includedir}/QtGui/
%{libqt5_includedir}/QtEglFSDeviceIntegration/
%exclude %{libqt5_includedir}/QtGui/%{so_version}
%exclude %{libqt5_includedir}/QtEglFSDeviceIntegration/%{so_version}
%files devel
%defattr(-,root,root,755)
@ -1130,17 +1158,70 @@ popd
%files -n libQt5PlatformSupport-devel-static
%defattr(-,root,root,755)
%doc *.txt LICENSE.*
%{libqt5_libdir}/libQt5EglDeviceIntegration.so
%{libqt5_libdir}/libQt5XcbQpa.so
%{libqt5_libdir}/libQt5PlatformSupport.a
%{libqt5_libdir}/libQt5PlatformSupport.prl
%{libqt5_libdir}/libQt5EglDeviceIntegration.prl
%{libqt5_libdir}/libQt5XcbQpa.prl
#{libqt5_libdir}/pkgconfig/Qt5PlatformSupport.pc
#{libqt5_libdir}/pkgconfig/Qt5EglDeviceIntegration.pc
#{libqt5_libdir}/pkgconfig/Qt5XcbQpa.pc
%{libqt5_includedir}/QtPlatformSupport/
%exclude %{libqt5_includedir}/QtPlatformSupport/%{so_version}
%{libqt5_libdir}/libQt5AccessibilitySupport.a
%{libqt5_libdir}/libQt5AccessibilitySupport.prl
%{libqt5_libdir}/libQt5DeviceDiscoverySupport.a
%{libqt5_libdir}/libQt5DeviceDiscoverySupport.prl
%{libqt5_libdir}/libQt5EglSupport.a
%{libqt5_libdir}/libQt5EglSupport.prl
%{libqt5_libdir}/libQt5EventDispatcherSupport.a
%{libqt5_libdir}/libQt5EventDispatcherSupport.prl
%{libqt5_libdir}/libQt5FbSupport.a
%{libqt5_libdir}/libQt5FbSupport.prl
%{libqt5_libdir}/libQt5FontDatabaseSupport.a
%{libqt5_libdir}/libQt5FontDatabaseSupport.prl
%ifnarch %arm aarch64
%{libqt5_libdir}/libQt5GlxSupport.a
%{libqt5_libdir}/libQt5GlxSupport.prl
%endif
%{libqt5_libdir}/libQt5InputSupport.a
%{libqt5_libdir}/libQt5InputSupport.prl
%{libqt5_libdir}/libQt5LinuxAccessibilitySupport.a
%{libqt5_libdir}/libQt5LinuxAccessibilitySupport.prl
%{libqt5_libdir}/libQt5PlatformCompositorSupport.a
%{libqt5_libdir}/libQt5PlatformCompositorSupport.prl
%{libqt5_libdir}/libQt5ServiceSupport.a
%{libqt5_libdir}/libQt5ServiceSupport.prl
%{libqt5_libdir}/libQt5ThemeSupport.a
%{libqt5_libdir}/libQt5ThemeSupport.prl
%{libqt5_includedir}/QtAccessibilitySupport/
%{libqt5_includedir}/QtDeviceDiscoverySupport/
%{libqt5_includedir}/QtEglSupport/
%{libqt5_includedir}/QtEventDispatcherSupport/
%{libqt5_includedir}/QtFbSupport/
%{libqt5_includedir}/QtFontDatabaseSupport/
%ifnarch %arm aarch64
%{libqt5_includedir}/QtGlxSupport/
%endif
%{libqt5_includedir}/QtInputSupport/
%{libqt5_includedir}/QtLinuxAccessibilitySupport/
%{libqt5_includedir}/QtPlatformCompositorSupport/
%{libqt5_includedir}/QtServiceSupport/
%{libqt5_includedir}/QtThemeSupport/
%exclude %{libqt5_includedir}/QtAccessibilitySupport/%{so_version}/
%exclude %{libqt5_includedir}/QtDeviceDiscoverySupport/%{so_version}/
%exclude %{libqt5_includedir}/QtEglSupport/%{so_version}/
%exclude %{libqt5_includedir}/QtEventDispatcherSupport/%{so_version}/
%exclude %{libqt5_includedir}/QtFbSupport/%{so_version}/
%exclude %{libqt5_includedir}/QtFontDatabaseSupport/%{so_version}/
%ifnarch %arm aarch64
%exclude %{libqt5_includedir}/QtGlxSupport/%{so_version}/
%endif
%exclude %{libqt5_includedir}/QtInputSupport/%{so_version}/
%exclude %{libqt5_includedir}/QtLinuxAccessibilitySupport/%{so_version}/
%exclude %{libqt5_includedir}/QtPlatformCompositorSupport/%{so_version}/
%exclude %{libqt5_includedir}/QtServiceSupport/%{so_version}/
%exclude %{libqt5_includedir}/QtThemeSupport/%{so_version}/
%files -n libQt5KmsSupport-devel-static
%defattr(-,root,root,755)
%doc *.txt LICENSE.*
%{libqt5_libdir}/libQt5KmsSupport.a
%{libqt5_libdir}/libQt5KmsSupport.prl
%exclude %{libqt5_includedir}/QtKmsSupport/%{so_version}/
%{libqt5_includedir}/QtKmsSupport/
%files -n libQt5Core-private-headers-devel
%defattr(-,root,root,755)
@ -1156,6 +1237,12 @@ popd
%defattr(-,root,root,755)
%doc *.txt LICENSE.*
%{libqt5_includedir}/QtGui/%{so_version}/
%{libqt5_includedir}/QtEglFSDeviceIntegration/%{so_version}
%files -n libQt5KmsSupport-private-headers-devel
%defattr(-,root,root,755)
%doc *.txt LICENSE.*
%{libqt5_includedir}/QtKmsSupport/%{so_version}/
%files -n libQt5Network-private-headers-devel
%defattr(-,root,root,755)
@ -1170,7 +1257,20 @@ popd
%files -n libQt5PlatformSupport-private-headers-devel
%defattr(-,root,root,755)
%doc *.txt LICENSE.*
%{libqt5_includedir}/QtPlatformSupport/%{so_version}/
%{libqt5_includedir}/QtAccessibilitySupport/%{so_version}/
%{libqt5_includedir}/QtDeviceDiscoverySupport/%{so_version}/
%{libqt5_includedir}/QtEglSupport/%{so_version}/
%{libqt5_includedir}/QtEventDispatcherSupport/%{so_version}/
%{libqt5_includedir}/QtFbSupport/%{so_version}/
%{libqt5_includedir}/QtFontDatabaseSupport/%{so_version}/
%ifnarch %arm aarch64
%{libqt5_includedir}/QtGlxSupport/%{so_version}/
%endif
%{libqt5_includedir}/QtInputSupport/%{so_version}/
%{libqt5_includedir}/QtLinuxAccessibilitySupport/%{so_version}/
%{libqt5_includedir}/QtPlatformCompositorSupport/%{so_version}/
%{libqt5_includedir}/QtServiceSupport/%{so_version}/
%{libqt5_includedir}/QtThemeSupport/%{so_version}/
%files -n libQt5PrintSupport-private-headers-devel
%defattr(-,root,root,755)

View File

@ -0,0 +1,30 @@
From 9ff4abfb4a2a76b2ed0f664876955a9ab3a5b726 Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@qt.io>
Date: Thu, 1 Jun 2017 17:45:02 +0200
Subject: [PATCH] Adjust offset of native children according to device pixel
ratio
Otherwise the wrong background can be used.
Task-number: QTBUG-59017
Change-Id: Iccbe9cd9704bccbceda4c8dafe87435b68b5cf3e
---
src/gui/painting/qplatformbackingstore.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index b8bbdef..b88dd76 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -394,7 +394,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
d_ptr->blitter->setRedBlueSwizzle(true);
// The backingstore is for the entire tlw.
// In case of native children offset tells the position relative to the tlw.
- const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(offset), d_ptr->textureSize.height());
+ const QRect srcRect = toBottomLeftRect(deviceWindowRect.translated(offset * window->devicePixelRatio()), d_ptr->textureSize.height());
const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(srcRect,
d_ptr->textureSize,
origin);
--
2.7.4

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:edcdf549d94d98aff08e201dcb3ca25bc3628a37b1309e320d5f556b6b66557e
size 44992616

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:267eb2af1a203c087f2113f43b08014d0e2d2cb269295b8602d869a2fad5296c
size 44893232

View File

@ -1,15 +1,10 @@
diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
index aefd3ae..53a3f60 100644
index f6cbf99..798472a 100644
--- a/mkspecs/features/qt_module.prf
+++ b/mkspecs/features/qt_module.prf
@@ -195,16 +195,18 @@
!header_module:unix:!isEmpty(QMAKE_LFLAGS_VERSION_SCRIPT):!no_linker_version_script:!static {
verscript = $${TARGET}.version
@@ -214,9 +214,9 @@ android: CONFIG += qt_android_deps no_linker_version_script
QMAKE_LFLAGS += $${QMAKE_LFLAGS_VERSION_SCRIPT}$$verscript
+ private_api_headers = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.QPA_HEADER_FILES
+
internal_module {
- verscript_content = "Qt_$${QT_MAJOR_VERSION}_PRIVATE_API { *; };"
+ verscript_content = "Qt_$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}_PRIVATE_API { *; };"
@ -17,23 +12,5 @@ index aefd3ae..53a3f60 100644
- verscript_content = "Qt_$${QT_MAJOR_VERSION}_PRIVATE_API {" \
+ verscript_content = "Qt_$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}_PRIVATE_API {" \
" qt_private_api_tag*;"
- for(header, SYNCQT.PRIVATE_HEADER_FILES): \
+ for(header, private_api_headers): \
verscript_content += " @FILE:$${_PRO_FILE_PWD_}/$$header@"
verscript_content += "};"
current = Qt_$$QT_MAJOR_VERSION
verscript_content += "$$current { *; };"
@@ -221,11 +223,11 @@
# Add a post-processing step to replace the @FILE:filename@
verscript_in = $${verscript}.in
verscriptprocess.name = linker version script ${QMAKE_FILE_BASE}
verscriptprocess.input = verscript_in
verscriptprocess.CONFIG += no_link target_predeps
- for(header, SYNCQT.PRIVATE_HEADER_FILES): \
+ for(header, private_api_headers): \
verscriptprocess.depends += $${_PRO_FILE_PWD_}/$$header
verscriptprocess.output = $$verscript
verscriptprocess.commands = perl $${PWD}/data/unix/findclasslist.pl < ${QMAKE_FILE_IN} > $@
silent:verscriptprocess.commands = @echo creating linker version script ${QMAKE_FILE_BASE} && $$verscriptprocess.commands
QMAKE_EXTRA_COMPILERS += verscriptprocess
private_api_headers = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.QPA_HEADER_FILES