Merge commit '580f183d5a1d5c539c92ee2c5aaf34df21fc3f8e' into f23
This commit is contained in:
commit
b72517215c
88
0087-xcb-Fix-drag-and-drop-between-xcb-screens.patch
Normal file
88
0087-xcb-Fix-drag-and-drop-between-xcb-screens.patch
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
From 78ad8f208d8dbe3575194bb9b97d4e42efdc32d5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= <spaz16@wp.pl>
|
||||||
|
Date: Mon, 15 Feb 2016 20:50:16 +0100
|
||||||
|
Subject: [PATCH 087/652] xcb: Fix drag and drop between xcb screens
|
||||||
|
|
||||||
|
Set the proper screen before creating a shaped pixmap window in
|
||||||
|
QBasicDrag::startDrag(). Grab mouse again when D&D window is
|
||||||
|
recreated.
|
||||||
|
|
||||||
|
Task-number: QTBUG-51215
|
||||||
|
Change-Id: I5cb47d3b11672b56d17b32072d84a722bdcdcd9a
|
||||||
|
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
|
||||||
|
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
|
||||||
|
---
|
||||||
|
src/gui/kernel/qsimpledrag.cpp | 5 +++--
|
||||||
|
src/gui/kernel/qsimpledrag_p.h | 3 +++
|
||||||
|
src/plugins/platforms/xcb/qxcbdrag.cpp | 4 ++++
|
||||||
|
3 files changed, 10 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
|
||||||
|
index 9f38c9b..00589d2 100644
|
||||||
|
--- a/src/gui/kernel/qsimpledrag.cpp
|
||||||
|
+++ b/src/gui/kernel/qsimpledrag.cpp
|
||||||
|
@@ -88,7 +88,8 @@ static QWindow* topLevelAt(const QPoint &pos)
|
||||||
|
QBasicDrag::QBasicDrag() :
|
||||||
|
m_restoreCursor(false), m_eventLoop(0),
|
||||||
|
m_executed_drop_action(Qt::IgnoreAction), m_can_drop(false),
|
||||||
|
- m_drag(0), m_drag_icon_window(0), m_useCompositing(true)
|
||||||
|
+ m_drag(0), m_drag_icon_window(0), m_useCompositing(true),
|
||||||
|
+ m_screen(Q_NULLPTR)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -211,7 +212,7 @@ void QBasicDrag::startDrag()
|
||||||
|
pos = QPoint();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
- recreateShapedPixmapWindow(Q_NULLPTR, pos);
|
||||||
|
+ recreateShapedPixmapWindow(m_screen, pos);
|
||||||
|
enableEventFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h
|
||||||
|
index 055136c..b208c8c 100644
|
||||||
|
--- a/src/gui/kernel/qsimpledrag_p.h
|
||||||
|
+++ b/src/gui/kernel/qsimpledrag_p.h
|
||||||
|
@@ -90,6 +90,8 @@ protected:
|
||||||
|
bool useCompositing() const { return m_useCompositing; }
|
||||||
|
void setUseCompositing(bool on) { m_useCompositing = on; }
|
||||||
|
|
||||||
|
+ void setScreen(QScreen *screen) { m_screen = screen; }
|
||||||
|
+
|
||||||
|
Qt::DropAction executedDropAction() const { return m_executed_drop_action; }
|
||||||
|
void setExecutedDropAction(Qt::DropAction da) { m_executed_drop_action = da; }
|
||||||
|
|
||||||
|
@@ -108,6 +110,7 @@ private:
|
||||||
|
QDrag *m_drag;
|
||||||
|
QShapedPixmapWindow *m_drag_icon_window;
|
||||||
|
bool m_useCompositing;
|
||||||
|
+ QScreen *m_screen;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Q_GUI_EXPORT QSimpleDrag : public QBasicDrag
|
||||||
|
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
|
||||||
|
index 9296a6d..aa6445d 100644
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
|
||||||
|
@@ -193,6 +193,7 @@ void QXcbDrag::startDrag()
|
||||||
|
XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData());
|
||||||
|
|
||||||
|
setUseCompositing(current_virtual_desktop->compositingActive());
|
||||||
|
+ setScreen(current_virtual_desktop->screens().constFirst()->screen());
|
||||||
|
QBasicDrag::startDrag();
|
||||||
|
if (connection()->mouseGrabber() == Q_NULLPTR)
|
||||||
|
shapedPixmapWindow()->setMouseGrabEnabled(true);
|
||||||
|
@@ -322,6 +323,9 @@ void QXcbDrag::move(const QPoint &globalPos)
|
||||||
|
if (virtualDesktop != current_virtual_desktop) {
|
||||||
|
setUseCompositing(virtualDesktop->compositingActive());
|
||||||
|
recreateShapedPixmapWindow(static_cast<QPlatformScreen*>(screen)->screen(), deviceIndependentPos);
|
||||||
|
+ if (connection()->mouseGrabber() == Q_NULLPTR)
|
||||||
|
+ shapedPixmapWindow()->setMouseGrabEnabled(true);
|
||||||
|
+
|
||||||
|
current_virtual_desktop = virtualDesktop;
|
||||||
|
} else {
|
||||||
|
QBasicDrag::moveShapedPixmapWindow(deviceIndependentPos);
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
From b024fbe83863fc57364a52c717d5b43d654bdb5d Mon Sep 17 00:00:00 2001
|
From b77ef8a7e6e4104067d52824e29eadc8c66f5929 Mon Sep 17 00:00:00 2001
|
||||||
From: Weng Xuetian <wengxt@gmail.com>
|
From: Weng Xuetian <wengxt@gmail.com>
|
||||||
Date: Sat, 5 Mar 2016 12:23:21 -0800
|
Date: Sat, 5 Mar 2016 12:23:21 -0800
|
||||||
Subject: [PATCH] QtDBus: clean up signal hooks and object tree in
|
Subject: [PATCH 415/595] QtDBus: clean up signal hooks and object tree in
|
||||||
closeConnection
|
closeConnection
|
||||||
|
|
||||||
If a QObject is added or passed as receiver to QDBusConnection::connect()
|
If a QObject is added or passed as receiver to QDBusConnection::connect()
|
||||||
@ -13,10 +13,11 @@ lock since the thread is no longer processing events.
|
|||||||
|
|
||||||
Task-number: QTBUG-51648
|
Task-number: QTBUG-51648
|
||||||
Change-Id: I1a1810a6d6d0234af0269d5f3fc1f54101bf1547
|
Change-Id: I1a1810a6d6d0234af0269d5f3fc1f54101bf1547
|
||||||
|
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
||||||
---
|
---
|
||||||
src/dbus/qdbusconnection_p.h | 1 +
|
src/dbus/qdbusconnection_p.h | 1 +
|
||||||
src/dbus/qdbusintegrator.cpp | 28 +++++++++++++++++++++++++++-
|
src/dbus/qdbusintegrator.cpp | 26 +++++++++++++++++++++++++-
|
||||||
2 files changed, 28 insertions(+), 1 deletion(-)
|
2 files changed, 26 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
|
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
|
||||||
index c77daf7..565eb83 100644
|
index c77daf7..565eb83 100644
|
||||||
@ -31,10 +32,10 @@ index c77daf7..565eb83 100644
|
|||||||
bool isServiceRegisteredByThread(const QString &serviceName);
|
bool isServiceRegisteredByThread(const QString &serviceName);
|
||||||
|
|
||||||
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
|
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
|
||||||
index cd44861..a3cd47b 100644
|
index 478a2c4..3be775d 100644
|
||||||
--- a/src/dbus/qdbusintegrator.cpp
|
--- a/src/dbus/qdbusintegrator.cpp
|
||||||
+++ b/src/dbus/qdbusintegrator.cpp
|
+++ b/src/dbus/qdbusintegrator.cpp
|
||||||
@@ -1030,7 +1030,6 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
|
@@ -1050,7 +1050,6 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
|
||||||
qPrintable(name));
|
qPrintable(name));
|
||||||
|
|
||||||
closeConnection();
|
closeConnection();
|
||||||
@ -42,7 +43,7 @@ index cd44861..a3cd47b 100644
|
|||||||
qDeleteAll(cachedMetaObjects);
|
qDeleteAll(cachedMetaObjects);
|
||||||
|
|
||||||
if (mode == ClientMode || mode == PeerMode) {
|
if (mode == ClientMode || mode == PeerMode) {
|
||||||
@@ -1052,6 +1051,20 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
|
@@ -1072,6 +1071,19 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,23 +56,21 @@ index cd44861..a3cd47b 100644
|
|||||||
+ it++;
|
+ it++;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (haystack.obj) {
|
+ if (haystack.obj)
|
||||||
+ haystack.obj->disconnect(this);
|
+ haystack.obj->disconnect(this);
|
||||||
+}
|
+}
|
||||||
+}
|
|
||||||
+
|
+
|
||||||
void QDBusConnectionPrivate::closeConnection()
|
void QDBusConnectionPrivate::closeConnection()
|
||||||
{
|
{
|
||||||
QDBusWriteLocker locker(CloseConnectionAction, this);
|
QDBusWriteLocker locker(CloseConnectionAction, this);
|
||||||
@@ -1075,6 +1088,19 @@ void QDBusConnectionPrivate::closeConnection()
|
@@ -1095,6 +1107,18 @@ void QDBusConnectionPrivate::closeConnection()
|
||||||
}
|
}
|
||||||
|
|
||||||
qDeleteAll(pendingCalls);
|
qDeleteAll(pendingCalls);
|
||||||
+
|
+
|
||||||
+ // clean up all signal hook and object tree, to avoid QObject::destroyed
|
+ // Disconnect all signals from signal hooks and from the object tree to
|
||||||
+ // being activated to dbus daemon thread which already quits.
|
+ // avoid QObject::destroyed being sent to dbus daemon thread which has
|
||||||
+ // dbus connection is already closed, so there is nothing we could do be clean
|
+ // already quit.
|
||||||
+ // up everything here.
|
|
||||||
+ SignalHookHash::iterator sit = signalHooks.begin();
|
+ SignalHookHash::iterator sit = signalHooks.begin();
|
||||||
+ while (sit != signalHooks.end()) {
|
+ while (sit != signalHooks.end()) {
|
||||||
+ sit.value().obj->disconnect(this);
|
+ sit.value().obj->disconnect(this);
|
||||||
@ -84,5 +83,5 @@ index cd44861..a3cd47b 100644
|
|||||||
|
|
||||||
void QDBusConnectionPrivate::checkThread()
|
void QDBusConnectionPrivate::checkThread()
|
||||||
--
|
--
|
||||||
2.5.0
|
2.7.4
|
||||||
|
|
@ -0,0 +1,98 @@
|
|||||||
|
From 269fdbdd2bedda5f5eacb751224d3a3fc3eed5bc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Urs Fleisch <ufleisch@users.sourceforge.net>
|
||||||
|
Date: Fri, 26 Feb 2016 17:46:09 +0100
|
||||||
|
Subject: [PATCH 508/652] xcb: Fix drag and drop to applications like Emacs and
|
||||||
|
Chromium.
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Drops without matching time stamp do not work. I have fixed the issue by
|
||||||
|
reanimating the findXdndAwareParent() function (adapted to XCB) and
|
||||||
|
using it to find a matching transaction if all else fails.
|
||||||
|
|
||||||
|
Task-number: QTBUG-45812
|
||||||
|
Change-Id: Ibca15bbab02ccf2f25280418e9edf36972ebf9a0
|
||||||
|
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
|
||||||
|
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
|
||||||
|
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
|
||||||
|
---
|
||||||
|
src/plugins/platforms/xcb/qxcbdrag.cpp | 55 +++++++++++++++++++++++++++-------
|
||||||
|
1 file changed, 44 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
|
||||||
|
index f5cc873..f1428d0 100644
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
|
||||||
|
@@ -1072,6 +1072,40 @@ void QXcbDrag::cancel()
|
||||||
|
send_leave();
|
||||||
|
}
|
||||||
|
|
||||||
|
+// find an ancestor with XdndAware on it
|
||||||
|
+static xcb_window_t findXdndAwareParent(QXcbConnection *c, xcb_window_t window)
|
||||||
|
+{
|
||||||
|
+ xcb_window_t target = 0;
|
||||||
|
+ forever {
|
||||||
|
+ // check if window has XdndAware
|
||||||
|
+ xcb_get_property_cookie_t gpCookie = Q_XCB_CALL(
|
||||||
|
+ xcb_get_property(c->xcb_connection(), false, window,
|
||||||
|
+ c->atom(QXcbAtom::XdndAware), XCB_GET_PROPERTY_TYPE_ANY, 0, 0));
|
||||||
|
+ xcb_get_property_reply_t *gpReply = xcb_get_property_reply(
|
||||||
|
+ c->xcb_connection(), gpCookie, 0);
|
||||||
|
+ bool aware = gpReply && gpReply->type != XCB_NONE;
|
||||||
|
+ free(gpReply);
|
||||||
|
+ if (aware) {
|
||||||
|
+ target = window;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ // try window's parent
|
||||||
|
+ xcb_query_tree_cookie_t qtCookie = Q_XCB_CALL(
|
||||||
|
+ xcb_query_tree_unchecked(c->xcb_connection(), window));
|
||||||
|
+ xcb_query_tree_reply_t *qtReply = xcb_query_tree_reply(
|
||||||
|
+ c->xcb_connection(), qtCookie, NULL);
|
||||||
|
+ if (!qtReply)
|
||||||
|
+ break;
|
||||||
|
+ xcb_window_t root = qtReply->root;
|
||||||
|
+ xcb_window_t parent = qtReply->parent;
|
||||||
|
+ free(qtReply);
|
||||||
|
+ if (window == root)
|
||||||
|
+ break;
|
||||||
|
+ window = parent;
|
||||||
|
+ }
|
||||||
|
+ return target;
|
||||||
|
+}
|
||||||
|
|
||||||
|
void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event)
|
||||||
|
{
|
||||||
|
@@ -1099,17 +1133,16 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event
|
||||||
|
// xcb_convert_selection() that we sent the XdndDrop event to.
|
||||||
|
at = findTransactionByWindow(event->requestor);
|
||||||
|
}
|
||||||
|
-// if (at == -1 && event->time == XCB_CURRENT_TIME) {
|
||||||
|
-// // previous Qt versions always requested the data on a child of the target window
|
||||||
|
-// // using CurrentTime... but it could be asking for either drop data or the current drag's data
|
||||||
|
-// Window target = findXdndAwareParent(event->requestor);
|
||||||
|
-// if (target) {
|
||||||
|
-// if (current_target && current_target == target)
|
||||||
|
-// at = -2;
|
||||||
|
-// else
|
||||||
|
-// at = findXdndDropTransactionByWindow(target);
|
||||||
|
-// }
|
||||||
|
-// }
|
||||||
|
+
|
||||||
|
+ if (at == -1 && event->time == XCB_CURRENT_TIME) {
|
||||||
|
+ xcb_window_t target = findXdndAwareParent(connection(), event->requestor);
|
||||||
|
+ if (target) {
|
||||||
|
+ if (current_target == target)
|
||||||
|
+ at = -2;
|
||||||
|
+ else
|
||||||
|
+ at = findTransactionByWindow(target);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
QDrag *transactionDrag = 0;
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
@ -1,40 +1,117 @@
|
|||||||
From 136eeec876ed5b995e7c27bcdcefe0199f5f183d Mon Sep 17 00:00:00 2001
|
From 9be4ee52021bbb3227611979319ab5e3106063b2 Mon Sep 17 00:00:00 2001
|
||||||
From: Weng Xuetian <wengxt@gmail.com>
|
From: Weng Xuetian <wengxt@gmail.com>
|
||||||
Date: Thu, 3 Mar 2016 21:56:53 -0800
|
Date: Thu, 3 Mar 2016 21:56:53 -0800
|
||||||
Subject: [PATCH] QtDBus: finish all pending call with error if disconnected
|
Subject: [PATCH 537/595] QtDBus: finish all pending call with error if
|
||||||
|
disconnected
|
||||||
|
|
||||||
libdbus will send a local signal if connection gets disconnected. When
|
libdbus will send a local signal if connection gets disconnected. When
|
||||||
this happens, end all pending calls with QDBusError::Disconnected.
|
this happens, end all pending calls with QDBusError::Disconnected.
|
||||||
|
|
||||||
Task-number: QTBUG-51649
|
Task-number: QTBUG-51649
|
||||||
Change-Id: I5c7d2a468bb5da746d0c0e53e458c1e376f186a9
|
Change-Id: I5c7d2a468bb5da746d0c0e53e458c1e376f186a9
|
||||||
|
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
|
||||||
---
|
---
|
||||||
src/dbus/qdbusintegrator.cpp | 26 +++++++++++++++++-----
|
src/dbus/dbus_minimal_p.h | 2 ++
|
||||||
src/dbus/qdbusutil_p.h | 6 +++++
|
src/dbus/qdbusconnection_p.h | 3 ++
|
||||||
.../dbus/qdbusconnection/tst_qdbusconnection.cpp | 22 ++++++++++++++++++
|
src/dbus/qdbusintegrator.cpp | 41 ++++++++++++++++++----
|
||||||
|
src/dbus/qdbusutil_p.h | 2 ++
|
||||||
|
.../dbus/qdbusconnection/tst_qdbusconnection.cpp | 21 +++++++++++
|
||||||
.../dbus/qdbusconnection/tst_qdbusconnection.h | 1 +
|
.../dbus/qdbusconnection/tst_qdbusconnection.h | 1 +
|
||||||
4 files changed, 49 insertions(+), 6 deletions(-)
|
6 files changed, 64 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/dbus/dbus_minimal_p.h b/src/dbus/dbus_minimal_p.h
|
||||||
|
index f0a2954..8f25b24 100644
|
||||||
|
--- a/src/dbus/dbus_minimal_p.h
|
||||||
|
+++ b/src/dbus/dbus_minimal_p.h
|
||||||
|
@@ -99,9 +99,11 @@ typedef dbus_uint32_t dbus_bool_t;
|
||||||
|
/* dbus-shared.h */
|
||||||
|
#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
|
||||||
|
#define DBUS_PATH_DBUS "/org/freedesktop/DBus"
|
||||||
|
+#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local"
|
||||||
|
#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
|
||||||
|
#define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable"
|
||||||
|
#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties"
|
||||||
|
+#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local"
|
||||||
|
|
||||||
|
#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */
|
||||||
|
#define DBUS_NAME_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */
|
||||||
|
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
|
||||||
|
index 565eb83..b733a68 100644
|
||||||
|
--- a/src/dbus/qdbusconnection_p.h
|
||||||
|
+++ b/src/dbus/qdbusconnection_p.h
|
||||||
|
@@ -260,6 +260,8 @@ private:
|
||||||
|
|
||||||
|
QString getNameOwnerNoCache(const QString &service);
|
||||||
|
|
||||||
|
+ void watchForDBusDisconnection();
|
||||||
|
+
|
||||||
|
void _q_newConnection(QDBusConnectionPrivate *newConnection);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
@@ -279,6 +281,7 @@ private slots:
|
||||||
|
void serviceOwnerChangedNoLock(const QString &name, const QString &oldOwner, const QString &newOwner);
|
||||||
|
void registerServiceNoLock(const QString &serviceName);
|
||||||
|
void unregisterServiceNoLock(const QString &serviceName);
|
||||||
|
+ void handleDBusDisconnection();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dispatchStatusChanged();
|
||||||
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
|
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
|
||||||
index cd44861..320419f 100644
|
index 3be775d..d0468f4 100644
|
||||||
--- a/src/dbus/qdbusintegrator.cpp
|
--- a/src/dbus/qdbusintegrator.cpp
|
||||||
+++ b/src/dbus/qdbusintegrator.cpp
|
+++ b/src/dbus/qdbusintegrator.cpp
|
||||||
@@ -519,6 +519,14 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
|
@@ -1121,6 +1121,12 @@ void QDBusConnectionPrivate::closeConnection()
|
||||||
switch (amsg.type()) {
|
rootNode.children.clear(); // free resources
|
||||||
case QDBusMessage::SignalMessage:
|
}
|
||||||
handleSignal(amsg);
|
|
||||||
+ // Check local disconnected signal from libdbus
|
+void QDBusConnectionPrivate::handleDBusDisconnection()
|
||||||
+ if (amsg.interface() == QDBusUtil::dbusInterfaceLocal()
|
+{
|
||||||
+ && amsg.path() == QDBusUtil::dbusPathLocal()
|
|
||||||
+ && amsg.member() == QDBusUtil::disconnected()
|
|
||||||
+ && !QDBusMessagePrivate::isLocal(amsg)) {
|
|
||||||
+ while (!pendingCalls.isEmpty())
|
+ while (!pendingCalls.isEmpty())
|
||||||
+ processFinishedCall(pendingCalls.first());
|
+ processFinishedCall(pendingCalls.first());
|
||||||
+}
|
+}
|
||||||
// if there are any other filters in this DBusConnection,
|
+
|
||||||
// let them see the signal too
|
void QDBusConnectionPrivate::checkThread()
|
||||||
return false;
|
{
|
||||||
@@ -1767,10 +1775,16 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call)
|
Q_ASSERT(thread() == QDBusConnectionManager::instance());
|
||||||
|
@@ -1646,6 +1652,19 @@ void QDBusConnectionPrivate::handleSignal(const QDBusMessage& msg)
|
||||||
|
handleSignal(key, msg); // third try
|
||||||
|
}
|
||||||
|
|
||||||
|
+void QDBusConnectionPrivate::watchForDBusDisconnection()
|
||||||
|
+{
|
||||||
|
+ SignalHook hook;
|
||||||
|
+ // Initialize the hook for Disconnected signal
|
||||||
|
+ hook.service.clear(); // org.freedesktop.DBus.Local.Disconnected uses empty service name
|
||||||
|
+ hook.path = QDBusUtil::dbusPathLocal();
|
||||||
|
+ hook.obj = this;
|
||||||
|
+ hook.params << QMetaType::Void;
|
||||||
|
+ hook.midx = staticMetaObject.indexOfSlot("handleDBusDisconnection()");
|
||||||
|
+ Q_ASSERT(hook.midx != -1);
|
||||||
|
+ signalHooks.insert(QLatin1String("Disconnected:" DBUS_INTERFACE_LOCAL), hook);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void QDBusConnectionPrivate::setServer(QDBusServer *object, DBusServer *s, const QDBusErrorInternal &error)
|
||||||
|
{
|
||||||
|
mode = ServerMode;
|
||||||
|
@@ -1711,6 +1730,8 @@ void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal
|
||||||
|
qDBusSignalFilter,
|
||||||
|
this, 0);
|
||||||
|
|
||||||
|
+ watchForDBusDisconnection();
|
||||||
|
+
|
||||||
|
QMetaObject::invokeMethod(this, "doDispatch", Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1787,6 +1808,8 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
|
||||||
|
Q_ASSERT(hook.midx != -1);
|
||||||
|
signalHooks.insert(QLatin1String("NameOwnerChanged:" DBUS_INTERFACE_DBUS), hook);
|
||||||
|
|
||||||
|
+ watchForDBusDisconnection();
|
||||||
|
+
|
||||||
|
qDBusDebug() << this << ": connected successfully";
|
||||||
|
|
||||||
|
// schedule a dispatch:
|
||||||
|
@@ -1813,10 +1836,16 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call)
|
||||||
|
|
||||||
QDBusMessage &msg = call->replyMessage;
|
QDBusMessage &msg = call->replyMessage;
|
||||||
if (call->pending) {
|
if (call->pending) {
|
||||||
@ -55,7 +132,7 @@ index cd44861..320419f 100644
|
|||||||
}
|
}
|
||||||
qDBusDebug() << connection << "got message reply:" << msg;
|
qDBusDebug() << connection << "got message reply:" << msg;
|
||||||
|
|
||||||
@@ -2070,8 +2084,8 @@ void QDBusConnectionPrivate::sendInternal(QDBusPendingCallPrivate *pcall, void *
|
@@ -2116,8 +2145,8 @@ void QDBusConnectionPrivate::sendInternal(QDBusPendingCallPrivate *pcall, void *
|
||||||
pcall->pending = pending;
|
pcall->pending = pending;
|
||||||
q_dbus_pending_call_set_notify(pending, qDBusResultReceived, pcall, 0);
|
q_dbus_pending_call_set_notify(pending, qDBusResultReceived, pcall, 0);
|
||||||
|
|
||||||
@ -67,7 +144,7 @@ index cd44861..320419f 100644
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
diff --git a/src/dbus/qdbusutil_p.h b/src/dbus/qdbusutil_p.h
|
diff --git a/src/dbus/qdbusutil_p.h b/src/dbus/qdbusutil_p.h
|
||||||
index 8f5ae92..ca70ff9 100644
|
index 8f5ae92..f4ab9b9 100644
|
||||||
--- a/src/dbus/qdbusutil_p.h
|
--- a/src/dbus/qdbusutil_p.h
|
||||||
+++ b/src/dbus/qdbusutil_p.h
|
+++ b/src/dbus/qdbusutil_p.h
|
||||||
@@ -155,6 +155,8 @@ namespace QDBusUtil
|
@@ -155,6 +155,8 @@ namespace QDBusUtil
|
||||||
@ -79,42 +156,28 @@ index 8f5ae92..ca70ff9 100644
|
|||||||
inline QString dbusInterface()
|
inline QString dbusInterface()
|
||||||
{
|
{
|
||||||
// it's the same string, but just be sure
|
// it's the same string, but just be sure
|
||||||
@@ -165,8 +167,12 @@ namespace QDBusUtil
|
|
||||||
{ return QStringLiteral(DBUS_INTERFACE_PROPERTIES); }
|
|
||||||
inline QString dbusInterfaceIntrospectable()
|
|
||||||
{ return QStringLiteral(DBUS_INTERFACE_INTROSPECTABLE); }
|
|
||||||
+ inline QString dbusInterfaceLocal()
|
|
||||||
+ { return QStringLiteral(DBUS_INTERFACE_LOCAL); }
|
|
||||||
inline QString nameOwnerChanged()
|
|
||||||
{ return QStringLiteral("NameOwnerChanged"); }
|
|
||||||
+ inline QString disconnected()
|
|
||||||
+ { return QStringLiteral("Disconnected"); }
|
|
||||||
inline QString disconnectedErrorMessage()
|
|
||||||
{ return QStringLiteral("Not connected to D-Bus server"); }
|
|
||||||
}
|
|
||||||
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
|
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
|
||||||
index e91f87d..6c7e6b1 100644
|
index e91f87d..f378091 100644
|
||||||
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
|
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
|
||||||
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
|
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
|
||||||
@@ -1218,6 +1218,28 @@ void tst_QDBusConnection::callVirtualObjectLocal()
|
@@ -1218,6 +1218,27 @@ void tst_QDBusConnection::callVirtualObjectLocal()
|
||||||
QCOMPARE(obj.replyArguments, subPathReply.arguments());
|
QCOMPARE(obj.replyArguments, subPathReply.arguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
+void tst_QDBusConnection::pendingCallWhenDisconnected()
|
+void tst_QDBusConnection::pendingCallWhenDisconnected()
|
||||||
+{
|
+{
|
||||||
|
+ if (!QCoreApplication::instance())
|
||||||
|
+ QSKIP("Test requires a QCoreApplication");
|
||||||
|
+
|
||||||
+ QDBusServer *server = new QDBusServer;
|
+ QDBusServer *server = new QDBusServer;
|
||||||
+ QDBusConnection con = QDBusConnection::connectToPeer(server->address(), "disconnect");
|
+ QDBusConnection con = QDBusConnection::connectToPeer(server->address(), "disconnect");
|
||||||
+ QTestEventLoop::instance().enterLoop(2);
|
+ QTestEventLoop::instance().enterLoop(2);
|
||||||
+ QVERIFY(!QTestEventLoop::instance().timeout());
|
|
||||||
+ QVERIFY(con.isConnected());
|
|
||||||
+
|
|
||||||
+ delete server;
|
|
||||||
+
|
|
||||||
+ // Make sure we call the method before we know it is disconnected.
|
|
||||||
+ QVERIFY(con.isConnected());
|
+ QVERIFY(con.isConnected());
|
||||||
+ QDBusMessage message = QDBusMessage::createMethodCall("", "/", QString(), "method");
|
+ QDBusMessage message = QDBusMessage::createMethodCall("", "/", QString(), "method");
|
||||||
+ QDBusPendingCall reply = con.asyncCall(message);
|
+ QDBusPendingCall reply = con.asyncCall(message);
|
||||||
+
|
+
|
||||||
|
+ delete server;
|
||||||
|
+
|
||||||
+ QTestEventLoop::instance().enterLoop(2);
|
+ QTestEventLoop::instance().enterLoop(2);
|
||||||
+ QVERIFY(!con.isConnected());
|
+ QVERIFY(!con.isConnected());
|
||||||
+ QVERIFY(reply.isFinished());
|
+ QVERIFY(reply.isFinished());
|
||||||
@ -138,19 +201,5 @@ index a53ba32..720e484 100644
|
|||||||
public:
|
public:
|
||||||
QString serviceName() const { return "org.qtproject.Qt.Autotests.QDBusConnection"; }
|
QString serviceName() const { return "org.qtproject.Qt.Autotests.QDBusConnection"; }
|
||||||
--
|
--
|
||||||
2.5.0
|
2.7.4
|
||||||
|
|
||||||
diff -up qtbase-opensource-src-5.6.0-rc/src/dbus/dbus_minimal_p.h.QTBUG-51649 qtbase-opensource-src-5.6.0-rc/src/dbus/dbus_minimal_p.h
|
|
||||||
--- qtbase-opensource-src-5.6.0-rc/src/dbus/dbus_minimal_p.h.QTBUG-51649 2016-02-18 01:24:38.000000000 -0600
|
|
||||||
+++ qtbase-opensource-src-5.6.0-rc/src/dbus/dbus_minimal_p.h 2016-03-11 11:40:11.176244645 -0600
|
|
||||||
@@ -99,8 +99,10 @@ typedef dbus_uint32_t dbus_bool_t;
|
|
||||||
/* dbus-shared.h */
|
|
||||||
#define DBUS_SERVICE_DBUS "org.freedesktop.DBus"
|
|
||||||
#define DBUS_PATH_DBUS "/org/freedesktop/DBus"
|
|
||||||
+#define DBUS_PATH_LOCAL "/org/freedesktop/DBus/Local"
|
|
||||||
#define DBUS_INTERFACE_DBUS "org.freedesktop.DBus"
|
|
||||||
#define DBUS_INTERFACE_INTROSPECTABLE "org.freedesktop.DBus.Introspectable"
|
|
||||||
+#define DBUS_INTERFACE_LOCAL "org.freedesktop.DBus.Local"
|
|
||||||
#define DBUS_INTERFACE_PROPERTIES "org.freedesktop.DBus.Properties"
|
|
||||||
|
|
||||||
#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */
|
|
41
0554-xcb-Fix-drag-and-drop-to-Emacs.patch
Normal file
41
0554-xcb-Fix-drag-and-drop-to-Emacs.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From c6d041e7ca3eb7945bf143a5c4fffcb2b2afba75 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Urs Fleisch <ufleisch@users.sourceforge.net>
|
||||||
|
Date: Sun, 1 May 2016 14:31:48 +0200
|
||||||
|
Subject: [PATCH 554/652] xcb: Fix drag and drop to Emacs.
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Unfortunately, the improved patch for QTBUG-45812 fixed things for
|
||||||
|
Chromium, but did no longer work for Emacs. This fixes commit [269fdb]
|
||||||
|
to make it work for both Emacs and Chromium.
|
||||||
|
|
||||||
|
Task-number: QTBUG-45812
|
||||||
|
Change-Id: I2fca708503f27679681bc6959de1ad94943a063e
|
||||||
|
Reviewed-by: Dmitry Shachnev <mitya57@gmail.com>
|
||||||
|
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
|
||||||
|
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
|
||||||
|
---
|
||||||
|
src/plugins/platforms/xcb/qxcbdrag.cpp | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
|
||||||
|
index f1428d0..529f91e 100644
|
||||||
|
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
|
||||||
|
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
|
||||||
|
@@ -1134,10 +1134,10 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event
|
||||||
|
at = findTransactionByWindow(event->requestor);
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (at == -1 && event->time == XCB_CURRENT_TIME) {
|
||||||
|
+ if (at == -1) {
|
||||||
|
xcb_window_t target = findXdndAwareParent(connection(), event->requestor);
|
||||||
|
if (target) {
|
||||||
|
- if (current_target == target)
|
||||||
|
+ if (event->time == XCB_CURRENT_TIME && current_target == target)
|
||||||
|
at = -2;
|
||||||
|
else
|
||||||
|
at = findTransactionByWindow(target);
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
735
qt5-poll.patch
735
qt5-poll.patch
@ -1,735 +0,0 @@
|
|||||||
commit 8a2d9073e959356808ce1685822b839d880e6498
|
|
||||||
Author: Florian Weimer <fweimer@redhat.com>
|
|
||||||
Date: Fri Sep 14 17:27:35 2012 +0200
|
|
||||||
|
|
||||||
Replace most calls to select(2) with poll(2)
|
|
||||||
|
|
||||||
select(2) limits the number of file descriptor in a process to
|
|
||||||
FD_SETSIZE (typically 1023). Process creation and certain socket
|
|
||||||
operations fail because they call select(2) on a file descriptor outside
|
|
||||||
the FD_SETSIZE range.
|
|
||||||
|
|
||||||
The remaining select(2) calls are used for timeouts only, or are in the
|
|
||||||
traditional event loop. The glib-based event loop does not use
|
|
||||||
select(2), so this should be sufficient.
|
|
||||||
|
|
||||||
This change adds a poll emulation for VxWorks, which only offers
|
|
||||||
select(2).
|
|
||||||
|
|
||||||
Change-Id: I9b0cf5bec81da70b29c501c62d14fb57df87fa61
|
|
||||||
|
|
||||||
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
|
|
||||||
index e159bf8..bb8a3ae 100644
|
|
||||||
--- a/src/corelib/io/qprocess_unix.cpp
|
|
||||||
+++ b/src/corelib/io/qprocess_unix.cpp
|
|
||||||
@@ -134,13 +134,6 @@ static void qt_sa_sigchld_handler(int signum)
|
|
||||||
oldAction(signum);
|
|
||||||
}
|
|
||||||
|
|
||||||
-static inline void add_fd(int &nfds, int fd, fd_set *fdset)
|
|
||||||
-{
|
|
||||||
- FD_SET(fd, fdset);
|
|
||||||
- if ((fd) > nfds)
|
|
||||||
- nfds = fd;
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
struct QProcessInfo {
|
|
||||||
QProcess *process;
|
|
||||||
int deathPipe;
|
|
||||||
@@ -235,9 +228,9 @@ QProcessManager::~QProcessManager()
|
|
||||||
void QProcessManager::run()
|
|
||||||
{
|
|
||||||
forever {
|
|
||||||
- fd_set readset;
|
|
||||||
- FD_ZERO(&readset);
|
|
||||||
- FD_SET(qt_qprocess_deadChild_pipe[0], &readset);
|
|
||||||
+ pollfd fd;
|
|
||||||
+ fd.fd = qt_qprocess_deadChild_pipe[0];
|
|
||||||
+ fd.events = POLLIN;
|
|
||||||
|
|
||||||
#if defined (QPROCESS_DEBUG)
|
|
||||||
qDebug() << "QProcessManager::run() waiting for children to die";
|
|
||||||
@@ -246,8 +239,8 @@ void QProcessManager::run()
|
|
||||||
// block forever, or until activity is detected on the dead child
|
|
||||||
// pipe. the only other peers are the SIGCHLD signal handler, and the
|
|
||||||
// QProcessManager destructor.
|
|
||||||
- int nselect = select(qt_qprocess_deadChild_pipe[0] + 1, &readset, 0, 0, 0);
|
|
||||||
- if (nselect < 0) {
|
|
||||||
+ int ret = qt_safe_poll(&fd, 1, -1, /* retry_eintr */ false);
|
|
||||||
+ if (ret < 0) {
|
|
||||||
if (errno == EINTR)
|
|
||||||
continue;
|
|
||||||
break;
|
|
||||||
@@ -996,17 +989,6 @@ void QProcessPrivate::killProcess()
|
|
||||||
::kill(pid_t(pid), SIGKILL);
|
|
||||||
}
|
|
||||||
|
|
||||||
-static int select_msecs(int nfds, fd_set *fdread, fd_set *fdwrite, int timeout)
|
|
||||||
-{
|
|
||||||
- if (timeout < 0)
|
|
||||||
- return qt_safe_select(nfds, fdread, fdwrite, 0, 0);
|
|
||||||
-
|
|
||||||
- struct timeval tv;
|
|
||||||
- tv.tv_sec = timeout / 1000;
|
|
||||||
- tv.tv_usec = (timeout % 1000) * 1000;
|
|
||||||
- return qt_safe_select(nfds, fdread, fdwrite, 0, &tv);
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
/*
|
|
||||||
Returns the difference between msecs and elapsed. If msecs is -1,
|
|
||||||
however, -1 is returned.
|
|
||||||
@@ -1029,10 +1011,10 @@ bool QProcessPrivate::waitForStarted(int msecs)
|
|
||||||
childStartedPipe[0]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- fd_set fds;
|
|
||||||
- FD_ZERO(&fds);
|
|
||||||
- FD_SET(childStartedPipe[0], &fds);
|
|
||||||
- if (select_msecs(childStartedPipe[0] + 1, &fds, 0, msecs) == 0) {
|
|
||||||
+ pollfd fd;
|
|
||||||
+ fd.fd = childStartedPipe[0];
|
|
||||||
+ fd.events = POLLIN;
|
|
||||||
+ if (qt_safe_poll(&fd, 1, msecs) == 0) {
|
|
||||||
processError = QProcess::Timedout;
|
|
||||||
q->setErrorString(QProcess::tr("Process operation timed out"));
|
|
||||||
#if defined (QPROCESS_DEBUG)
|
|
||||||
@@ -1048,6 +1030,47 @@ bool QProcessPrivate::waitForStarted(int msecs)
|
|
||||||
return startedEmitted;
|
|
||||||
}
|
|
||||||
|
|
||||||
+class QProcessFDSet {
|
|
||||||
+ pollfd fds[5];
|
|
||||||
+
|
|
||||||
+ static size_t size()
|
|
||||||
+ {
|
|
||||||
+ return sizeof(fds)/sizeof(fds[0]);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+public:
|
|
||||||
+ QProcessFDSet(QProcessPrivate &proc)
|
|
||||||
+ {
|
|
||||||
+ for (size_t i = 0; i < size(); ++i) {
|
|
||||||
+ fds[i].fd = -1;
|
|
||||||
+ fds[i].events = POLLIN;
|
|
||||||
+ }
|
|
||||||
+ death().fd = proc.deathPipe[0];
|
|
||||||
+
|
|
||||||
+ if (proc.processState == QProcess::Starting)
|
|
||||||
+ started().fd = proc.childStartedPipe[0];
|
|
||||||
+
|
|
||||||
+ stdout().fd = proc.stdoutChannel.pipe[0];
|
|
||||||
+ stderr().fd = proc.stderrChannel.pipe[0];
|
|
||||||
+
|
|
||||||
+ if (!proc.writeBuffer.isEmpty()) {
|
|
||||||
+ stdin().fd = proc.stdinChannel.pipe[1];
|
|
||||||
+ stdin().events = POLLOUT;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ int poll(int timeout)
|
|
||||||
+ {
|
|
||||||
+ return qt_safe_poll(fds, size(), timeout);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ pollfd &death() { return fds[0]; }
|
|
||||||
+ pollfd &started() { return fds[1]; }
|
|
||||||
+ pollfd &stdout() { return fds[2]; }
|
|
||||||
+ pollfd &stderr() { return fds[3]; }
|
|
||||||
+ pollfd &stdin() { return fds[4]; }
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
bool QProcessPrivate::waitForReadyRead(int msecs)
|
|
||||||
{
|
|
||||||
Q_Q(QProcess);
|
|
||||||
@@ -1059,28 +1082,9 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
|
|
||||||
stopWatch.start();
|
|
||||||
|
|
||||||
forever {
|
|
||||||
- fd_set fdread;
|
|
||||||
- fd_set fdwrite;
|
|
||||||
-
|
|
||||||
- FD_ZERO(&fdread);
|
|
||||||
- FD_ZERO(&fdwrite);
|
|
||||||
-
|
|
||||||
- int nfds = deathPipe[0];
|
|
||||||
- FD_SET(deathPipe[0], &fdread);
|
|
||||||
-
|
|
||||||
- if (processState == QProcess::Starting)
|
|
||||||
- add_fd(nfds, childStartedPipe[0], &fdread);
|
|
||||||
-
|
|
||||||
- if (stdoutChannel.pipe[0] != -1)
|
|
||||||
- add_fd(nfds, stdoutChannel.pipe[0], &fdread);
|
|
||||||
- if (stderrChannel.pipe[0] != -1)
|
|
||||||
- add_fd(nfds, stderrChannel.pipe[0], &fdread);
|
|
||||||
-
|
|
||||||
- if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
|
|
||||||
- add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
|
|
||||||
-
|
|
||||||
+ QProcessFDSet fdset(*this);
|
|
||||||
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
|
|
||||||
- int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
|
|
||||||
+ int ret = fdset.poll(timeout);
|
|
||||||
if (ret < 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
@@ -1090,18 +1094,18 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
|
|
||||||
+ if (qt_readable(fdset.started())) {
|
|
||||||
if (!_q_startupNotification())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool readyReadEmitted = false;
|
|
||||||
- if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread)) {
|
|
||||||
+ if (qt_readable(fdset.stdout())) {
|
|
||||||
bool canRead = _q_canReadStandardOutput();
|
|
||||||
if (processChannel == QProcess::StandardOutput && canRead)
|
|
||||||
readyReadEmitted = true;
|
|
||||||
}
|
|
||||||
- if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread)) {
|
|
||||||
+ if (qt_readable(fdset.stderr())) {
|
|
||||||
bool canRead = _q_canReadStandardError();
|
|
||||||
if (processChannel == QProcess::StandardError && canRead)
|
|
||||||
readyReadEmitted = true;
|
|
||||||
@@ -1109,13 +1113,13 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
|
|
||||||
if (readyReadEmitted)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
- if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
|
|
||||||
+ if (qt_writable(fdset.stdin()))
|
|
||||||
_q_canWrite();
|
|
||||||
|
|
||||||
- if (deathPipe[0] == -1 || FD_ISSET(deathPipe[0], &fdread)) {
|
|
||||||
+ if (qt_readable(fdset.death())) {
|
|
||||||
if (_q_processDied())
|
|
||||||
return false;
|
|
||||||
- }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@@ -1131,29 +1135,9 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
|
|
||||||
stopWatch.start();
|
|
||||||
|
|
||||||
while (!writeBuffer.isEmpty()) {
|
|
||||||
- fd_set fdread;
|
|
||||||
- fd_set fdwrite;
|
|
||||||
-
|
|
||||||
- FD_ZERO(&fdread);
|
|
||||||
- FD_ZERO(&fdwrite);
|
|
||||||
-
|
|
||||||
- int nfds = deathPipe[0];
|
|
||||||
- FD_SET(deathPipe[0], &fdread);
|
|
||||||
-
|
|
||||||
- if (processState == QProcess::Starting)
|
|
||||||
- add_fd(nfds, childStartedPipe[0], &fdread);
|
|
||||||
-
|
|
||||||
- if (stdoutChannel.pipe[0] != -1)
|
|
||||||
- add_fd(nfds, stdoutChannel.pipe[0], &fdread);
|
|
||||||
- if (stderrChannel.pipe[0] != -1)
|
|
||||||
- add_fd(nfds, stderrChannel.pipe[0], &fdread);
|
|
||||||
-
|
|
||||||
-
|
|
||||||
- if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
|
|
||||||
- add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
|
|
||||||
-
|
|
||||||
+ QProcessFDSet fdset(*this);
|
|
||||||
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
|
|
||||||
- int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
|
|
||||||
+ int ret = fdset.poll(timeout);
|
|
||||||
if (ret < 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
@@ -1164,24 +1148,24 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
|
|
||||||
+ if (qt_readable(fdset.started())) {
|
|
||||||
if (!_q_startupNotification())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
|
|
||||||
+ if (qt_writable(fdset.stdin()))
|
|
||||||
return _q_canWrite();
|
|
||||||
|
|
||||||
- if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread))
|
|
||||||
+ if (qt_readable(fdset.stdout()))
|
|
||||||
_q_canReadStandardOutput();
|
|
||||||
|
|
||||||
- if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread))
|
|
||||||
+ if (qt_readable(fdset.stderr()))
|
|
||||||
_q_canReadStandardError();
|
|
||||||
|
|
||||||
- if (deathPipe[0] == -1 || FD_ISSET(deathPipe[0], &fdread)) {
|
|
||||||
- if (_q_processDied())
|
|
||||||
- return false;
|
|
||||||
- }
|
|
||||||
+ if (qt_readable(fdset.death())) {
|
|
||||||
+ if (_q_processDied())
|
|
||||||
+ return false;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
@@ -1198,29 +1182,9 @@ bool QProcessPrivate::waitForFinished(int msecs)
|
|
||||||
stopWatch.start();
|
|
||||||
|
|
||||||
forever {
|
|
||||||
- fd_set fdread;
|
|
||||||
- fd_set fdwrite;
|
|
||||||
- int nfds = -1;
|
|
||||||
-
|
|
||||||
- FD_ZERO(&fdread);
|
|
||||||
- FD_ZERO(&fdwrite);
|
|
||||||
-
|
|
||||||
- if (processState == QProcess::Starting)
|
|
||||||
- add_fd(nfds, childStartedPipe[0], &fdread);
|
|
||||||
-
|
|
||||||
- if (stdoutChannel.pipe[0] != -1)
|
|
||||||
- add_fd(nfds, stdoutChannel.pipe[0], &fdread);
|
|
||||||
- if (stderrChannel.pipe[0] != -1)
|
|
||||||
- add_fd(nfds, stderrChannel.pipe[0], &fdread);
|
|
||||||
-
|
|
||||||
- if (processState == QProcess::Running)
|
|
||||||
- add_fd(nfds, deathPipe[0], &fdread);
|
|
||||||
-
|
|
||||||
- if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
|
|
||||||
- add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
|
|
||||||
-
|
|
||||||
+ QProcessFDSet fdset(*this);
|
|
||||||
int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
|
|
||||||
- int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
|
|
||||||
+ int ret = fdset.poll(timeout);
|
|
||||||
if (ret < 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
@@ -1230,20 +1194,20 @@ bool QProcessPrivate::waitForFinished(int msecs)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
- if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
|
|
||||||
+ if (qt_readable(fdset.started())) {
|
|
||||||
if (!_q_startupNotification())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
- if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
|
|
||||||
+ if (qt_writable(fdset.stdin()))
|
|
||||||
_q_canWrite();
|
|
||||||
|
|
||||||
- if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread))
|
|
||||||
+ if (qt_readable(fdset.stdout()))
|
|
||||||
_q_canReadStandardOutput();
|
|
||||||
|
|
||||||
- if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread))
|
|
||||||
+ if (qt_readable(fdset.stderr()))
|
|
||||||
_q_canReadStandardError();
|
|
||||||
|
|
||||||
- if (deathPipe[0] == -1 || FD_ISSET(deathPipe[0], &fdread)) {
|
|
||||||
+ if (qt_readable(fdset.death())) {
|
|
||||||
if (_q_processDied())
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1253,10 +1217,10 @@ bool QProcessPrivate::waitForFinished(int msecs)
|
|
||||||
|
|
||||||
bool QProcessPrivate::waitForWrite(int msecs)
|
|
||||||
{
|
|
||||||
- fd_set fdwrite;
|
|
||||||
- FD_ZERO(&fdwrite);
|
|
||||||
- FD_SET(stdinChannel.pipe[1], &fdwrite);
|
|
||||||
- return select_msecs(stdinChannel.pipe[1] + 1, 0, &fdwrite, msecs < 0 ? 0 : msecs) == 1;
|
|
||||||
+ pollfd fd;
|
|
||||||
+ fd.fd = stdinChannel.pipe[1];
|
|
||||||
+ fd.events = POLLIN;
|
|
||||||
+ return qt_safe_poll(&fd, 1, msecs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void QProcessPrivate::findExitCode()
|
|
||||||
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
|
|
||||||
index cc54798..ca178bb 100644
|
|
||||||
--- a/src/corelib/kernel/qcore_unix.cpp
|
|
||||||
+++ b/src/corelib/kernel/qcore_unix.cpp
|
|
||||||
@@ -103,4 +103,165 @@ int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifndef Q_OS_VXWORKS
|
|
||||||
+
|
|
||||||
+int qt_safe_poll(struct pollfd *fds, int nfds, int timeout_ms, bool retry_eintr)
|
|
||||||
+{
|
|
||||||
+ if (nfds == 0)
|
|
||||||
+ return 0;
|
|
||||||
+ if (nfds < 0) {
|
|
||||||
+ errno = EINVAL;
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // Retry on ret == 0 if the deadline has not yet passed because
|
|
||||||
+ // Linux can return early from the syscall, without setting EINTR.
|
|
||||||
+ if (timeout_ms < 0) {
|
|
||||||
+ forever {
|
|
||||||
+ int ret = ::poll(fds, nfds, -1);
|
|
||||||
+ if (ret > 0)
|
|
||||||
+ return ret;
|
|
||||||
+ if (retry_eintr) {
|
|
||||||
+ if (ret == 0 || ret == -1 && errno == EINTR) {
|
|
||||||
+ continue;
|
|
||||||
+ } else {
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (ret == 0) {
|
|
||||||
+ errno = EINTR;
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ return ret;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ timeval previous = qt_gettime();
|
|
||||||
+ timeval deadline = previous;
|
|
||||||
+ deadline.tv_sec += timeout_ms / 1000;
|
|
||||||
+ deadline.tv_usec += (timeout_ms % 1000) * 1000;
|
|
||||||
+ if (deadline.tv_usec >= 1000000) {
|
|
||||||
+ ++deadline.tv_sec;
|
|
||||||
+ deadline.tv_usec -= 1000000;
|
|
||||||
+ }
|
|
||||||
+ int remaining = timeout_ms;
|
|
||||||
+
|
|
||||||
+ forever {
|
|
||||||
+ int ret = ::poll(fds, nfds, remaining);
|
|
||||||
+ if (ret > 0)
|
|
||||||
+ return ret;
|
|
||||||
+ timeval now = qt_gettime();
|
|
||||||
+ if ((now.tv_sec > deadline.tv_sec // past deadline
|
|
||||||
+ || (now.tv_sec == deadline.tv_sec
|
|
||||||
+ && now.tv_usec >= deadline.tv_usec))
|
|
||||||
+ || (now.tv_sec < previous.tv_sec // time warp
|
|
||||||
+ || (now.tv_sec == previous.tv_sec
|
|
||||||
+ && now.tv_usec < previous.tv_usec))
|
|
||||||
+ || (ret < 0 && (errno != EINTR || !retry_eintr))) // other error
|
|
||||||
+ return ret;
|
|
||||||
+ if (ret == 0 && !retry_eintr) {
|
|
||||||
+ errno = EINTR;
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ remaining = (deadline.tv_sec - now.tv_sec) * 1000
|
|
||||||
+ + (deadline.tv_usec - now.tv_usec) / 1000;
|
|
||||||
+ previous = now;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#else
|
|
||||||
+
|
|
||||||
+// Poll emulation for VxWorks.
|
|
||||||
+
|
|
||||||
+static int mark_bad_descriptors(pollfd *fds, int nfds)
|
|
||||||
+{
|
|
||||||
+ fd_set r;
|
|
||||||
+ FD_ZERO(&r);
|
|
||||||
+ struct timeval tv;
|
|
||||||
+ tv.tv_sec = 0;
|
|
||||||
+ tv.tv_usec = 0;
|
|
||||||
+ int ret = 0;
|
|
||||||
+
|
|
||||||
+ // Check each descriptor invidually for badness.
|
|
||||||
+ for (int i = 0; i < nfds; ++i) {
|
|
||||||
+ pollfd &fd(fds[i]);
|
|
||||||
+ if (fd.fd >= 0) {
|
|
||||||
+ FD_SET(fd.fd, &r);
|
|
||||||
+ int ret = qt_safe_select(fd.fd + 1, &r, NULL, NULL, &tv);
|
|
||||||
+ FD_CLR(fd.fd, &r);
|
|
||||||
+ if (ret < 0 && errno == EBADF) {
|
|
||||||
+ fd.revents = POLLNVAL;
|
|
||||||
+ ++ret;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ Q_ASSERT(ret > 0);
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int qt_safe_poll(pollfd *fds, int nfds, int timeout, bool retry_eintr)
|
|
||||||
+{
|
|
||||||
+ fd_set r, w;
|
|
||||||
+ FD_ZERO(&r);
|
|
||||||
+ FD_ZERO(&w);
|
|
||||||
+ int maxfd = -1;
|
|
||||||
+
|
|
||||||
+ // Extract the watched descriptors.
|
|
||||||
+ for (int i = 0; i < nfds; ++i) {
|
|
||||||
+ pollfd &fd(fds[i]);
|
|
||||||
+ if (fd.fd >= 0 && fd.fd < FD_SETSIZE) {
|
|
||||||
+ if (fd.events & POLLIN) {
|
|
||||||
+ FD_SET(fd.fd, &r);
|
|
||||||
+ if (fd.fd > maxfd)
|
|
||||||
+ maxfd = fd.fd;
|
|
||||||
+ }
|
|
||||||
+ if (fd.events & POLLOUT) {
|
|
||||||
+ FD_SET(fd.fd, &w);
|
|
||||||
+ if (fd.fd > maxfd)
|
|
||||||
+ maxfd = fd.fd;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ // If timeout is negative, wait indefinitely for activity.
|
|
||||||
+ timeval tv;
|
|
||||||
+ timeval *ptv;
|
|
||||||
+ if (timeout >= 0) {
|
|
||||||
+ tv.tv_sec = timeout / 1000;
|
|
||||||
+ tv.tv_usec = (timeout % 1000) * 1000;
|
|
||||||
+ ptv = &tv;
|
|
||||||
+ } else
|
|
||||||
+ ptv = NULL;
|
|
||||||
+
|
|
||||||
+ int ret;
|
|
||||||
+ if (retry_eintr)
|
|
||||||
+ ret = qt_safe_select(maxfd + 1, &r, &w, NULL, ptv);
|
|
||||||
+ else
|
|
||||||
+ ret = ::select(maxfd + 1, &r, &w, NULL, ptv);
|
|
||||||
+ if (ret < 0 && errno == EBADF) {
|
|
||||||
+ return mark_bad_descriptors(fds, nfds);
|
|
||||||
+ }
|
|
||||||
+ if (ret <= 0)
|
|
||||||
+ return ret;
|
|
||||||
+
|
|
||||||
+ // Set the revents flags.
|
|
||||||
+ ret = 0;
|
|
||||||
+ for (int i = 0; i < nfds; ++i) {
|
|
||||||
+ pollfd &fd(fds[i]);
|
|
||||||
+ fd.revents = 0;
|
|
||||||
+ if (fd.fd >= 0 && fd.fd < FD_SETSIZE) {
|
|
||||||
+ if ((fd.events & POLLIN) && FD_ISSET(fd.fd, &r))
|
|
||||||
+ fd.revents |= POLLIN;
|
|
||||||
+ if ((fd.events & POLLOUT) && FD_ISSET(fd.fd, &w))
|
|
||||||
+ fd.revents |= POLLOUT;
|
|
||||||
+ if (fd.revents)
|
|
||||||
+ ++ret;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ Q_ASSERT(ret > 0);
|
|
||||||
+ return ret;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#endif // Q_OS_VXWORKS
|
|
||||||
+
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
|
|
||||||
index 6342b03..f7f4767 100644
|
|
||||||
--- a/src/corelib/kernel/qcore_unix_p.h
|
|
||||||
+++ b/src/corelib/kernel/qcore_unix_p.h
|
|
||||||
@@ -71,6 +71,8 @@
|
|
||||||
|
|
||||||
#if defined(Q_OS_VXWORKS)
|
|
||||||
# include <ioLib.h>
|
|
||||||
+#else
|
|
||||||
+# include <poll.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct sockaddr;
|
|
||||||
@@ -341,6 +343,36 @@ void qt_nanosleep(timespec amount);
|
|
||||||
Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
|
|
||||||
const struct timeval *tv);
|
|
||||||
|
|
||||||
+#ifdef Q_OS_VXWORKS
|
|
||||||
+// Poll emulation for VxWorks. Provided by <poll.h> on other systems.
|
|
||||||
+
|
|
||||||
+struct pollfd {
|
|
||||||
+ int fd;
|
|
||||||
+ short events;
|
|
||||||
+ short revents;
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+#define POLLIN 1
|
|
||||||
+#define POLLOUT 2
|
|
||||||
+#define POLLERR 4
|
|
||||||
+#define POLLHUP 8
|
|
||||||
+#define POLLNVAL 16
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+inline bool qt_readable(const pollfd &fd)
|
|
||||||
+{
|
|
||||||
+ return fd.fd >= 0 && (fd.revents & (POLLIN | POLLHUP | POLLERR | POLLNVAL)) != 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+inline bool qt_writable(const pollfd &fd)
|
|
||||||
+{
|
|
||||||
+ return fd.fd >= 0 && (fd.revents & (POLLOUT | POLLHUP | POLLERR | POLLNVAL)) != 0;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+// Deprecated due to FD_SETSIZE limitation, use qt_safe_poll instead.
|
|
||||||
+Q_CORE_EXPORT int qt_safe_poll(pollfd *fds, int nfds, int timeout,
|
|
||||||
+ bool retry_eintr = true);
|
|
||||||
+
|
|
||||||
// according to X/OPEN we have to define semun ourselves
|
|
||||||
// we use prefix as on some systems sem.h will have it
|
|
||||||
struct semid_ds;
|
|
||||||
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
|
|
||||||
index 2bcf1ac..efb8128 100644
|
|
||||||
--- a/src/network/socket/qlocalserver_unix.cpp
|
|
||||||
+++ b/src/network/socket/qlocalserver_unix.cpp
|
|
||||||
@@ -293,16 +293,11 @@ void QLocalServerPrivate::_q_onNewConnection()
|
|
||||||
|
|
||||||
void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut)
|
|
||||||
{
|
|
||||||
- fd_set readfds;
|
|
||||||
- FD_ZERO(&readfds);
|
|
||||||
- FD_SET(listenSocket, &readfds);
|
|
||||||
+ struct pollfd fd;
|
|
||||||
+ fd.fd = listenSocket;
|
|
||||||
+ fd.events = POLLIN;
|
|
||||||
|
|
||||||
- timeval timeout;
|
|
||||||
- timeout.tv_sec = msec / 1000;
|
|
||||||
- timeout.tv_usec = (msec % 1000) * 1000;
|
|
||||||
-
|
|
||||||
- int result = -1;
|
|
||||||
- result = qt_safe_select(listenSocket + 1, &readfds, 0, 0, (msec == -1) ? 0 : &timeout);
|
|
||||||
+ int result = qt_safe_poll(&fd, 1, msec);
|
|
||||||
if (-1 == result) {
|
|
||||||
setError(QLatin1String("QLocalServer::waitForNewConnection"));
|
|
||||||
closeServer();
|
|
||||||
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
|
|
||||||
index 49eb71a..c598c2b 100644
|
|
||||||
--- a/src/network/socket/qlocalsocket_unix.cpp
|
|
||||||
+++ b/src/network/socket/qlocalsocket_unix.cpp
|
|
||||||
@@ -56,10 +56,6 @@
|
|
||||||
#include <qdebug.h>
|
|
||||||
#include <qelapsedtimer.h>
|
|
||||||
|
|
||||||
-#ifdef Q_OS_VXWORKS
|
|
||||||
-# include <selectLib.h>
|
|
||||||
-#endif
|
|
||||||
-
|
|
||||||
#define QT_CONNECT_TIMEOUT 30000
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
@@ -524,25 +520,16 @@ bool QLocalSocket::waitForConnected(int msec)
|
|
||||||
if (state() != ConnectingState)
|
|
||||||
return (state() == ConnectedState);
|
|
||||||
|
|
||||||
- fd_set fds;
|
|
||||||
- FD_ZERO(&fds);
|
|
||||||
- FD_SET(d->connectingSocket, &fds);
|
|
||||||
-
|
|
||||||
- timeval timeout;
|
|
||||||
- timeout.tv_sec = msec / 1000;
|
|
||||||
- timeout.tv_usec = (msec % 1000) * 1000;
|
|
||||||
+ pollfd fd;
|
|
||||||
+ fd.fd = d->connectingSocket;
|
|
||||||
+ fd.events = POLLIN | POLLOUT;
|
|
||||||
|
|
||||||
- // timeout can not be 0 or else select will return an error.
|
|
||||||
- if (0 == msec)
|
|
||||||
- timeout.tv_usec = 1000;
|
|
||||||
-
|
|
||||||
- int result = -1;
|
|
||||||
- // on Linux timeout will be updated by select, but _not_ on other systems.
|
|
||||||
+ int result;
|
|
||||||
QElapsedTimer timer;
|
|
||||||
+ int remaining = msec > 0 ? msec : 1000;
|
|
||||||
timer.start();
|
|
||||||
- while (state() == ConnectingState
|
|
||||||
- && (-1 == msec || timer.elapsed() < msec)) {
|
|
||||||
- result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout);
|
|
||||||
+ while (state() == ConnectingState) {
|
|
||||||
+ result = qt_safe_poll(&fd, 1, remaining, /* retry_eintr */ false);
|
|
||||||
if (-1 == result && errno != EINTR) {
|
|
||||||
d->errorOccurred( QLocalSocket::UnknownSocketError,
|
|
||||||
QLatin1String("QLocalSocket::waitForConnected"));
|
|
||||||
@@ -550,6 +537,11 @@ bool QLocalSocket::waitForConnected(int msec)
|
|
||||||
}
|
|
||||||
if (result > 0)
|
|
||||||
d->_q_connectToSocket();
|
|
||||||
+ if (msec >= 0) {
|
|
||||||
+ remaining = timer.elapsed() - msec;
|
|
||||||
+ if (remaining < 0)
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
return (state() == ConnectedState);
|
|
||||||
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
|
|
||||||
index 4f3408b..a1bb298 100644
|
|
||||||
--- a/src/network/socket/qnativesocketengine_unix.cpp
|
|
||||||
+++ b/src/network/socket/qnativesocketengine_unix.cpp
|
|
||||||
@@ -1122,48 +1122,40 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize)
|
|
||||||
|
|
||||||
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const
|
|
||||||
{
|
|
||||||
- fd_set fds;
|
|
||||||
- FD_ZERO(&fds);
|
|
||||||
- FD_SET(socketDescriptor, &fds);
|
|
||||||
-
|
|
||||||
- struct timeval tv;
|
|
||||||
- tv.tv_sec = timeout / 1000;
|
|
||||||
- tv.tv_usec = (timeout % 1000) * 1000;
|
|
||||||
-
|
|
||||||
- int retval;
|
|
||||||
- if (selectForRead)
|
|
||||||
- retval = qt_safe_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv);
|
|
||||||
- else
|
|
||||||
- retval = qt_safe_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv);
|
|
||||||
-
|
|
||||||
- return retval;
|
|
||||||
+ struct pollfd fd;
|
|
||||||
+ fd.fd = socketDescriptor;
|
|
||||||
+ if (selectForRead) {
|
|
||||||
+ fd.events = POLLIN;
|
|
||||||
+ } else {
|
|
||||||
+ fd.events = POLLOUT;
|
|
||||||
+ }
|
|
||||||
+ return qt_safe_poll(&fd, 1, timeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite,
|
|
||||||
bool *selectForRead, bool *selectForWrite) const
|
|
||||||
{
|
|
||||||
- fd_set fdread;
|
|
||||||
- FD_ZERO(&fdread);
|
|
||||||
+ struct pollfd fd;
|
|
||||||
+ fd.fd = socketDescriptor;
|
|
||||||
if (checkRead)
|
|
||||||
- FD_SET(socketDescriptor, &fdread);
|
|
||||||
-
|
|
||||||
- fd_set fdwrite;
|
|
||||||
- FD_ZERO(&fdwrite);
|
|
||||||
+ fd.events = POLLIN;
|
|
||||||
+ else
|
|
||||||
+ fd.events = 0;
|
|
||||||
if (checkWrite)
|
|
||||||
- FD_SET(socketDescriptor, &fdwrite);
|
|
||||||
-
|
|
||||||
- struct timeval tv;
|
|
||||||
- tv.tv_sec = timeout / 1000;
|
|
||||||
- tv.tv_usec = (timeout % 1000) * 1000;
|
|
||||||
-
|
|
||||||
- int ret;
|
|
||||||
- ret = qt_safe_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv);
|
|
||||||
-
|
|
||||||
+ fd.events |= POLLOUT;
|
|
||||||
+ int ret = qt_safe_poll(&fd, 1, timeout);
|
|
||||||
if (ret <= 0)
|
|
||||||
- return ret;
|
|
||||||
- *selectForRead = FD_ISSET(socketDescriptor, &fdread);
|
|
||||||
- *selectForWrite = FD_ISSET(socketDescriptor, &fdwrite);
|
|
||||||
-
|
|
||||||
+ return ret;
|
|
||||||
+ bool r = (fd.revents & (POLLIN | POLLHUP | POLLERR)) != 0;
|
|
||||||
+ bool w = (fd.revents & (POLLOUT | POLLHUP | POLLERR)) != 0;
|
|
||||||
+ // Emulate the return value from select(2).
|
|
||||||
+ ret = 0;
|
|
||||||
+ if (r)
|
|
||||||
+ ++ret;
|
|
||||||
+ if (w)
|
|
||||||
+ ++ret;
|
|
||||||
+ *selectForRead = r;
|
|
||||||
+ *selectForWrite = w;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
@ -48,18 +48,18 @@
|
|||||||
# only primary archs (for now), allow secondary to bootstrap
|
# only primary archs (for now), allow secondary to bootstrap
|
||||||
%if ! 0%{?bootstrap}
|
%if ! 0%{?bootstrap}
|
||||||
%ifarch %{arm} %{ix86} x86_64 %{power64} s390 s390x aarch64
|
%ifarch %{arm} %{ix86} x86_64 %{power64} s390 s390x aarch64
|
||||||
%define docs 1
|
%global docs 1
|
||||||
%endif
|
%endif
|
||||||
|
%global examples 1
|
||||||
|
%global tests 1
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%define examples 1
|
|
||||||
|
|
||||||
#define prerelease rc
|
#define prerelease rc
|
||||||
|
|
||||||
Summary: Qt5 - QtBase components
|
Summary: Qt5 - QtBase components
|
||||||
Name: qt5-qtbase
|
Name: qt5-qtbase
|
||||||
Version: 5.6.0
|
Version: 5.6.0
|
||||||
Release: 13%{?prerelease:.%{prerelease}}%{?dist}
|
Release: 19%{?prerelease:.%{prerelease}}%{?dist}
|
||||||
|
|
||||||
# See LGPL_EXCEPTIONS.txt, for exception details
|
# See LGPL_EXCEPTIONS.txt, for exception details
|
||||||
License: LGPLv2 with exceptions or GPLv3 with exceptions
|
License: LGPLv2 with exceptions or GPLv3 with exceptions
|
||||||
@ -87,10 +87,6 @@ Patch4: qtbase-opensource-src-5.3.2-QTBUG-35459.patch
|
|||||||
Patch12: qtbase-opensource-src-5.2.0-enable_ft_lcdfilter.patch
|
Patch12: qtbase-opensource-src-5.2.0-enable_ft_lcdfilter.patch
|
||||||
|
|
||||||
# upstreamable patches
|
# upstreamable patches
|
||||||
# support poll
|
|
||||||
# https://bugreports.qt-project.org/browse/QTBUG-27195
|
|
||||||
# NEEDS REBASE
|
|
||||||
Patch50: qt5-poll.patch
|
|
||||||
|
|
||||||
# Workaround moc/multilib issues
|
# Workaround moc/multilib issues
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1290020
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1290020
|
||||||
@ -100,12 +96,6 @@ Patch52: qtbase-opensource-src-5.6.0-moc_WORDSIZE.patch
|
|||||||
# arm patch
|
# arm patch
|
||||||
Patch54: qtbase-opensource-src-5.6.0-arm.patch
|
Patch54: qtbase-opensource-src-5.6.0-arm.patch
|
||||||
|
|
||||||
# https://codereview.qt-project.org/#/c/151496/
|
|
||||||
Patch55: QTBUG-51648-QtDBus-clean-up-signal-hooks-and-object-tree-in-clos.patch
|
|
||||||
|
|
||||||
# https://codereview.qt-project.org/#/c/151340/
|
|
||||||
Patch56: QTBUG-51649-QtDBus-finish-all-pending-call-with-error-if-disconn.patch
|
|
||||||
|
|
||||||
# recently passed code review, not integrated yet
|
# recently passed code review, not integrated yet
|
||||||
# https://codereview.qt-project.org/126102/
|
# https://codereview.qt-project.org/126102/
|
||||||
Patch60: moc-get-the-system-defines-from-the-compiler-itself.patch
|
Patch60: moc-get-the-system-defines-from-the-compiler-itself.patch
|
||||||
@ -115,12 +105,17 @@ Patch60: moc-get-the-system-defines-from-the-compiler-itself.patch
|
|||||||
# Item views, https://bugreports.qt.io/browse/QTBUG-48870
|
# Item views, https://bugreports.qt.io/browse/QTBUG-48870
|
||||||
Patch158: 0058-QtGui-Avoid-rgba64-rgba32-conversion-on-every-pixel-.patch
|
Patch158: 0058-QtGui-Avoid-rgba64-rgba32-conversion-on-every-pixel-.patch
|
||||||
Patch176: 0076-QListView-fix-skipping-indexes-in-selectedIndexes.patch
|
Patch176: 0076-QListView-fix-skipping-indexes-in-selectedIndexes.patch
|
||||||
|
Patch187: 0087-xcb-Fix-drag-and-drop-between-xcb-screens.patch
|
||||||
Patch201: 0101-xcb-include-cmath.patch
|
Patch201: 0101-xcb-include-cmath.patch
|
||||||
Patch277: 0177-Fix-GCC-6-Wunused-functions-warnings.patch
|
Patch277: 0177-Fix-GCC-6-Wunused-functions-warnings.patch
|
||||||
Patch278: 0178-qt_common.prf-when-looking-for-GCC-4.6-match-GCC-6-t.patch
|
Patch278: 0178-qt_common.prf-when-looking-for-GCC-4.6-match-GCC-6-t.patch
|
||||||
Patch301: 0201-alsatest-Fix-the-check-to-treat-alsalib-1.1.x-as-cor.patch
|
Patch301: 0201-alsatest-Fix-the-check-to-treat-alsalib-1.1.x-as-cor.patch
|
||||||
Patch321: 0221-QObject-fix-GCC-6-warning-about-qt_static_metacall-s.patch
|
Patch321: 0221-QObject-fix-GCC-6-warning-about-qt_static_metacall-s.patch
|
||||||
Patch393: 0293-Fix-QtDBus-deadlock-inside-kded-kiod.patch
|
Patch393: 0293-Fix-QtDBus-deadlock-inside-kded-kiod.patch
|
||||||
|
Patch515: 0415-QtDBus-clean-up-signal-hooks-and-object-tree-in-clos.patch
|
||||||
|
Patch608: 0508-xcb-Fix-drag-and-drop-to-applications-like-Emacs-and.patch
|
||||||
|
Patch637: 0537-QtDBus-finish-all-pending-call-with-error-if-disconn.patch
|
||||||
|
Patch654: 0554-xcb-Fix-drag-and-drop-to-Emacs.patch
|
||||||
|
|
||||||
# macros, be mindful to keep sync'd with macros.qt5
|
# macros, be mindful to keep sync'd with macros.qt5
|
||||||
Source10: macros.qt5
|
Source10: macros.qt5
|
||||||
@ -174,6 +169,7 @@ BuildRequires: pkgconfig(libproxy-1.0)
|
|||||||
BuildRequires: pkgconfig(ice) pkgconfig(sm)
|
BuildRequires: pkgconfig(ice) pkgconfig(sm)
|
||||||
BuildRequires: pkgconfig(libpng)
|
BuildRequires: pkgconfig(libpng)
|
||||||
BuildRequires: pkgconfig(libudev)
|
BuildRequires: pkgconfig(libudev)
|
||||||
|
%global openssl -openssl-linked
|
||||||
BuildRequires: pkgconfig(openssl)
|
BuildRequires: pkgconfig(openssl)
|
||||||
BuildRequires: pkgconfig(libpulse) pkgconfig(libpulse-mainloop-glib)
|
BuildRequires: pkgconfig(libpulse) pkgconfig(libpulse-mainloop-glib)
|
||||||
%if 0%{?fedora}
|
%if 0%{?fedora}
|
||||||
@ -213,6 +209,13 @@ BuildRequires: libicu-devel
|
|||||||
BuildRequires: pkgconfig(xcb) pkgconfig(xcb-glx) pkgconfig(xcb-icccm) pkgconfig(xcb-image) pkgconfig(xcb-keysyms) pkgconfig(xcb-renderutil)
|
BuildRequires: pkgconfig(xcb) pkgconfig(xcb-glx) pkgconfig(xcb-icccm) pkgconfig(xcb-image) pkgconfig(xcb-keysyms) pkgconfig(xcb-renderutil)
|
||||||
BuildRequires: pkgconfig(zlib)
|
BuildRequires: pkgconfig(zlib)
|
||||||
|
|
||||||
|
%if 0%{?tests}
|
||||||
|
BuildRequires: dbus-x11
|
||||||
|
BuildRequires: mesa-dri-drivers
|
||||||
|
BuildRequires: time
|
||||||
|
BuildRequires: xorg-x11-server-Xvfb
|
||||||
|
%endif
|
||||||
|
|
||||||
%if 0%{?qtchooser}
|
%if 0%{?qtchooser}
|
||||||
%if 0%{?fedora}
|
%if 0%{?fedora}
|
||||||
Conflicts: qt < 1:4.8.6-10
|
Conflicts: qt < 1:4.8.6-10
|
||||||
@ -363,19 +366,21 @@ RPM macros for building Qt5 packages.
|
|||||||
|
|
||||||
%patch52 -p1 -b .moc_WORDSIZE
|
%patch52 -p1 -b .moc_WORDSIZE
|
||||||
%patch54 -p1 -b .arm
|
%patch54 -p1 -b .arm
|
||||||
%patch55 -p1 -b .QTBUG-51648
|
|
||||||
## FTBFS, omit for now
|
|
||||||
%patch56 -p1 -b .QTBUG-51649
|
|
||||||
%patch60 -p1 -b .moc_system_defines
|
%patch60 -p1 -b .moc_system_defines
|
||||||
|
|
||||||
%patch158 -p1 -b .0058
|
%patch158 -p1 -b .0058
|
||||||
%patch176 -p1 -b .0076
|
%patch176 -p1 -b .0076
|
||||||
|
%patch187 -p1 -b .0087
|
||||||
%patch201 -p1 -b .0101
|
%patch201 -p1 -b .0101
|
||||||
%patch277 -p1 -b .0177
|
%patch277 -p1 -b .0177
|
||||||
%patch278 -p1 -b .0178
|
%patch278 -p1 -b .0178
|
||||||
%patch301 -p1 -b .0201
|
%patch301 -p1 -b .0201
|
||||||
%patch321 -p1 -b .0221
|
%patch321 -p1 -b .0221
|
||||||
%patch393 -p1 -b .0293
|
%patch393 -p1 -b .0293
|
||||||
|
%patch515 -p1 -b .0415
|
||||||
|
%patch608 -p1 -b .0508
|
||||||
|
%patch637 -p1 -b .0537
|
||||||
|
%patch654 -p1 -b .0554
|
||||||
|
|
||||||
%define platform linux-g++
|
%define platform linux-g++
|
||||||
|
|
||||||
@ -461,10 +466,10 @@ export MAKEFLAGS="%{?_smp_mflags}"
|
|||||||
-iconv \
|
-iconv \
|
||||||
-icu \
|
-icu \
|
||||||
%{?journald} \
|
%{?journald} \
|
||||||
-openssl-linked \
|
%{?openssl} \
|
||||||
-optimized-qmake \
|
-optimized-qmake \
|
||||||
%{!?examples:-nomake examples} \
|
%{!?examples:-nomake examples} \
|
||||||
-nomake tests \
|
%{!?tests:-nomake tests} \
|
||||||
-no-pch \
|
-no-pch \
|
||||||
-no-rpath \
|
-no-rpath \
|
||||||
-no-separate-debug-info \
|
-no-separate-debug-info \
|
||||||
@ -604,17 +609,23 @@ popd
|
|||||||
|
|
||||||
install -p -m755 -D %{SOURCE6} %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d/10-qt5-check-opengl2.sh
|
install -p -m755 -D %{SOURCE6} %{buildroot}%{_sysconfdir}/X11/xinit/xinitrc.d/10-qt5-check-opengl2.sh
|
||||||
|
|
||||||
## work-in-progress, doesn't work yet -- rex
|
|
||||||
%check
|
%check
|
||||||
export CMAKE_PREFIX_PATH=%{buildroot}%{_prefix}
|
%if 0%{?tests}
|
||||||
|
## see tests/README for expected environment (running a plasma session essentially)
|
||||||
|
## we are not quite there yet
|
||||||
export CTEST_OUTPUT_ON_FAILURE=1
|
export CTEST_OUTPUT_ON_FAILURE=1
|
||||||
export PATH=%{buildroot}%{_bindir}:$PATH
|
export PATH=%{buildroot}%{_qt5_bindir}:$PATH
|
||||||
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
|
export LD_LIBRARY_PATH=%{buildroot}%{_qt5_libdir}
|
||||||
mkdir -p tests/auto/cmake/%{_target_platform}
|
# dbus tests error out when building if session bus is not available
|
||||||
pushd tests/auto/cmake/%{_target_platform}
|
dbus-launch --exit-with-session \
|
||||||
cmake .. ||:
|
make sub-tests %{?_smp_mflags} -k ||:
|
||||||
ctest --output-on-failure ||:
|
xvfb-run -a --server-args="-screen 0 1280x1024x32" \
|
||||||
popd
|
dbus-launch --exit-with-session \
|
||||||
|
time \
|
||||||
|
make check -k ||:
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?qtchooser}
|
%if 0%{?qtchooser}
|
||||||
%pre
|
%pre
|
||||||
@ -930,6 +941,7 @@ fi
|
|||||||
%{_qt5_libdir}/libQt5EglDeviceIntegration.so.5*
|
%{_qt5_libdir}/libQt5EglDeviceIntegration.so.5*
|
||||||
%{_qt5_plugindir}/platforms/libqeglfs.so
|
%{_qt5_plugindir}/platforms/libqeglfs.so
|
||||||
%{_qt5_plugindir}/platforms/libqminimalegl.so
|
%{_qt5_plugindir}/platforms/libqminimalegl.so
|
||||||
|
%dir %{_qt5_plugindir}/egldeviceintegrations/
|
||||||
%{_qt5_plugindir}/egldeviceintegrations/libqeglfs-kms-integration.so
|
%{_qt5_plugindir}/egldeviceintegrations/libqeglfs-kms-integration.so
|
||||||
%{_qt5_plugindir}/egldeviceintegrations/libqeglfs-x11-integration.so
|
%{_qt5_plugindir}/egldeviceintegrations/libqeglfs-x11-integration.so
|
||||||
%{_qt5_plugindir}/xcbglintegrations/libqxcb-egl-integration.so
|
%{_qt5_plugindir}/xcbglintegrations/libqxcb-egl-integration.so
|
||||||
@ -959,6 +971,27 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 13 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-19
|
||||||
|
- pull in upstream drag-n-drop related fixes (QTBUG-45812, QTBUG-51215)
|
||||||
|
|
||||||
|
* Sat May 07 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-18
|
||||||
|
- revert out-of-tree build, breaks Qt5*Config.cmake *_PRIVATE_INCLUDE_DIRS entries (all blank)
|
||||||
|
|
||||||
|
* Thu May 05 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-17
|
||||||
|
- support out-of-tree build
|
||||||
|
- better %%check
|
||||||
|
- pull in final/upstream fixes for QTBUG-51648,QTBUG-51649
|
||||||
|
- disable examples/tests in bootstrap mode
|
||||||
|
|
||||||
|
* Sat Apr 30 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-16
|
||||||
|
- own %%{_qt5_plugindir}/egldeviceintegrations
|
||||||
|
|
||||||
|
* Mon Apr 18 2016 Caolán McNamara <caolanm@redhat.com> - 5.6.0-15
|
||||||
|
- full rebuild for hunspell 1.4.0
|
||||||
|
|
||||||
|
* Mon Apr 18 2016 Caolán McNamara <caolanm@redhat.com> - 5.6.0-14
|
||||||
|
- bootstrap rebuild for hunspell 1.4.0
|
||||||
|
|
||||||
* Sat Apr 16 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-13
|
* Sat Apr 16 2016 Rex Dieter <rdieter@fedoraproject.org> - 5.6.0-13
|
||||||
- -devel: Provides: qt5-qtbase-private-devel (#1233829)
|
- -devel: Provides: qt5-qtbase-private-devel (#1233829)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user