From 37a2b82d00d55b7816f149ee8b6cf3fa6b1dae28 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 14 Sep 2013 15:56:46 +0200 Subject: accessible: fix if (!foo != const) construct Fixes a Clang warning. Change-Id: I114cf0f84ef9a4fe4ae814cedca883945d76e86c Reviewed-by: Frederik Gladhorn --- src/plugins/accessible/widgets/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/accessible/widgets/main.cpp b/src/plugins/accessible/widgets/main.cpp index 686a90ca96..36ee784aac 100644 --- a/src/plugins/accessible/widgets/main.cpp +++ b/src/plugins/accessible/widgets/main.cpp @@ -115,7 +115,7 @@ QAccessibleInterface *AccessibleFactory::create(const QString &classname, QObjec QToolButton *tb = qobject_cast(widget); if (!tb->menu()) role = tb->isCheckable() ? QAccessible::CheckBox : QAccessible::PushButton; - else if (!tb->popupMode() != QToolButton::DelayedPopup) + else if (tb->popupMode() == QToolButton::DelayedPopup) role = QAccessible::ButtonDropDown; else #endif -- cgit v1.2.3 From 26ddb586acd49834c7cffac781ce504ec78635cc Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 9 Sep 2013 13:10:37 +0200 Subject: xcb: QWindow never uses XCB_GRAVITY_CENTER Center gravity doesn't mean center the window, it only affects the method of converting between internal window bounds and decorated bounds. So wanting to have each dialog centered w.r.t. its transient parent is not a reason for using center gravity. Instead it caused the bug that when you resize a QMessageBox by clicking the Show Details button, it jumps downwards on the screen. Task-number: QTBUG-32473 Change-Id: I3fabf3caa1e4d10fd4f7508e297f73efe5cc51b6 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/xcb/qxcbwindow.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 028cd9ab72..37b96fc391 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -646,7 +646,6 @@ void QXcbWindow::show() if (!transientXcbParent) transientXcbParent = static_cast(screen())->clientLeader(); if (transientXcbParent) { // ICCCM 4.1.2.6 - m_gravity = XCB_GRAVITY_CENTER; Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, 1, &transientXcbParent)); @@ -1302,9 +1301,6 @@ QRect QXcbWindow::windowToWmGeometry(QRect r) const r.translate(m_frameMargins.left(), m_frameMargins.top()); } else if (!frameInclusive && m_gravity == XCB_GRAVITY_NORTH_WEST) { r.translate(-m_frameMargins.left(), -m_frameMargins.top()); - } else if (!frameInclusive && m_gravity == XCB_GRAVITY_CENTER) { - r.translate(-(m_frameMargins.left() - m_frameMargins.right())/2, - -(m_frameMargins.top() - m_frameMargins.bottom())/2); } return r; } -- cgit v1.2.3 From 14bcdce819e372b38e83055a08a52a0c423a8b4d Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sat, 14 Sep 2013 21:47:49 +0800 Subject: Doc: Remove space between class name and method name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the generated documentation contained "QFutureWatcher:: progressValueChanged()". While it is legal C++, it prevented QDoc from auto-linking to the QFutureWatcher class reference. Change-Id: I2cace763f1825b0b4478b2bde95679d25df8bb5e Reviewed-by: Topi Reiniƶ Reviewed-by: Jerome Pasion --- src/concurrent/doc/src/qtconcurrent-index.qdoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/concurrent/doc/src/qtconcurrent-index.qdoc b/src/concurrent/doc/src/qtconcurrent-index.qdoc index c884b0da07..d259516119 100644 --- a/src/concurrent/doc/src/qtconcurrent-index.qdoc +++ b/src/concurrent/doc/src/qtconcurrent-index.qdoc @@ -117,8 +117,8 @@ Random access iterators can be faster in cases where Qt Concurrent is iterating over a large number of lightweight items, since they allow skipping to any point in the container. In addition, using random access iterators allows Qt Concurrent - to provide progress information trough QFuture::progressValue() and QFutureWatcher:: - progressValueChanged(). + to provide progress information trough QFuture::progressValue() and + QFutureWatcher::progressValueChanged(). The non in-place modifying functions such as mapped() and filtered() makes a copy of the container when called. If you are using STL containers this copy operation -- cgit v1.2.3 From edf1a5706eebb6f2df14c5f524c7261f88d6cd75 Mon Sep 17 00:00:00 2001 From: Sze Howe Koh Date: Sun, 15 Sep 2013 09:23:23 +0800 Subject: Doc: Remove duplicated Qt Concurrent overview - The "Concurrent Programming" page is an exact duplicate of the Qt Concurrent module landing page. - The "qtconcurrent intro" target is not referenced anywhere. Change-Id: Ice9b4360783013fe972258ca54a0004be43b8766 Reviewed-by: Jerome Pasion --- src/concurrent/qtconcurrentfilter.cpp | 2 +- src/concurrent/qtconcurrentmap.cpp | 6 +- src/concurrent/qtconcurrentrun.cpp | 2 +- src/corelib/doc/src/threads.qdoc | 108 +--------------------------- src/corelib/thread/qfuture.qdoc | 5 +- src/corelib/thread/qfuturesynchronizer.qdoc | 2 +- src/corelib/thread/qfuturewatcher.cpp | 2 +- 7 files changed, 11 insertions(+), 116 deletions(-) (limited to 'src') diff --git a/src/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp index ef0229a695..7889fbff56 100644 --- a/src/concurrent/qtconcurrentfilter.cpp +++ b/src/concurrent/qtconcurrentfilter.cpp @@ -47,7 +47,7 @@ \brief The header provides concurrent Filter and Filter-Reduce. - These functions are a part of the \l {Concurrent Programming}{Qt Concurrent} framework. + These functions are a part of the \l {Qt Concurrent} framework. The QtConcurrent::filter(), QtConcurrent::filtered() and QtConcurrent::filteredReduced() functions filter items in a sequence such diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp index 9718baf48f..da2a601ae2 100644 --- a/src/concurrent/qtconcurrentmap.cpp +++ b/src/concurrent/qtconcurrentmap.cpp @@ -47,8 +47,8 @@ possible to write multi-threaded programs without using low-level threading primitives. - See the \l {Concurrent Programming}{Qt Concurrent} chapter in - the \l{threads.html}{threading} documentation. + See the \l {Qt Concurrent} module documentation for an overview of available + functions, or see below for detailed information on each function. \inheaderfile QtConcurrent \ingroup thread @@ -74,7 +74,7 @@ \brief The header provides concurrent Map and MapReduce. - These functions are a part of the \l {Concurrent Programming}{Qt Concurrent} framework. + These functions are a part of the \l {Qt Concurrent} framework. The QtConcurrent::map(), QtConcurrent::mapped() and QtConcurrent::mappedReduced() functions run computations in parallel on diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp index 4ab1399c0c..4398e1a91f 100644 --- a/src/concurrent/qtconcurrentrun.cpp +++ b/src/concurrent/qtconcurrentrun.cpp @@ -48,7 +48,7 @@ \ingroup thread - This function is a part of the \l {Concurrent Programming}{Qt Concurrent} framework. + This function is a part of the \l {Qt Concurrent} framework. The QtConcurrent::run() function runs a function in a separate thread. The return value of the function is made available through the QFuture API. diff --git a/src/corelib/doc/src/threads.qdoc b/src/corelib/doc/src/threads.qdoc index 27aca86406..1a31aa7815 100644 --- a/src/corelib/doc/src/threads.qdoc +++ b/src/corelib/doc/src/threads.qdoc @@ -63,7 +63,6 @@ \li \l{Synchronizing Threads} \li \l{Reentrancy and Thread-Safety} \li \l{Threads and QObjects} - \li \l{Concurrent Programming} \li \l{Thread-Support in Qt Modules} \endlist @@ -449,7 +448,7 @@ \previouspage Reentrancy and Thread Safety \contentspage Thread Support in Qt - \nextpage Concurrent Programming + \nextpage Thread-Support in Qt Modules QThread inherits QObject. It emits signals to indicate that the thread started or finished executing, and provides a few slots as @@ -645,114 +644,11 @@ a TCP server asynchronously. */ -/*! - \page threads-qtconcurrent.html - \title Concurrent Programming - - \previouspage Threads and QObjects - \contentspage Thread Support in Qt - \nextpage Thread-Support in Qt Modules - - \target qtconcurrent intro - - The QtConcurrent namespace provides high-level APIs that make it - possible to write multi-threaded programs without using low-level - threading primitives such as mutexes, read-write locks, wait - conditions, or semaphores. Programs written with QtConcurrent - automatically adjust the number of threads used according to the - number of processor cores available. This means that applications - written today will continue to scale when deployed on multi-core - systems in the future. - - QtConcurrent includes functional programming style APIs for - parallel list processing, including a MapReduce and FilterReduce - implementation for shared-memory (non-distributed) systems, and - classes for managing asynchronous computations in GUI - applications: - - \list - - \li QtConcurrent::map() applies a function to every item in a container, - modifying the items in-place. - - \li QtConcurrent::mapped() is like map(), except that it returns a new - container with the modifications. - - \li QtConcurrent::mappedReduced() is like mapped(), except that the - modified results are reduced or folded into a single result. - - \li QtConcurrent::filter() removes all items from a container based on the - result of a filter function. - - \li QtConcurrent::filtered() is like filter(), except that it returns a new - container with the filtered results. - - \li QtConcurrent::filteredReduced() is like filtered(), except that the - filtered results are reduced or folded into a single result. - - \li QtConcurrent::run() runs a function in another thread. - - \li QFuture represents the result of an asynchronous computation. - - \li QFutureIterator allows iterating through results available via QFuture. - - \li QFutureWatcher allows monitoring a QFuture using signals-and-slots. - - \li QFutureSynchronizer is a convenience class that automatically - synchronizes several QFutures. - - \endlist - - Qt Concurrent supports several STL-compatible container and iterator types, - but works best with Qt containers that have random-access iterators, such as - QList or QVector. The map and filter functions accept both containers and begin/end iterators. - - STL Iterator support overview: - - \table - \header - \li Iterator Type - \li Example classes - \li Support status - \row - \li Input Iterator - \li - \li Not Supported - \row - \li Output Iterator - \li - \li Not Supported - \row - \li Forward Iterator - \li std::slist - \li Supported - \row - \li Bidirectional Iterator - \li QLinkedList, std::list - \li Supported - \row - \li Random Access Iterator - \li QList, QVector, std::vector - \li Supported and Recommended - \endtable - - Random access iterators can be faster in cases where Qt Concurrent is iterating - over a large number of lightweight items, since they allow skipping to any point - in the container. In addition, using random access iterators allows Qt Concurrent - to provide progress information trough QFuture::progressValue() and QFutureWatcher:: - progressValueChanged(). - - The non in-place modifying functions such as mapped() and filtered() makes a - copy of the container when called. If you are using STL containers this copy operation - might take some time, in this case we recommend specifying the begin and end iterators - for the container instead. -*/ - /*! \page threads-modules.html \title Thread-Support in Qt Modules - \previouspage Concurrent Programming + \previouspage Threads and QObjects \contentspage Thread Support in Qt \section1 Threads and the SQL Module diff --git a/src/corelib/thread/qfuture.qdoc b/src/corelib/thread/qfuture.qdoc index 421e683c4a..7ae3e4a87e 100644 --- a/src/corelib/thread/qfuture.qdoc +++ b/src/corelib/thread/qfuture.qdoc @@ -47,8 +47,7 @@ \ingroup thread - To start a computation, use one of the APIs in the - \l {Concurrent Programming}{Qt Concurrent} framework. + To start a computation, use one of the APIs in the \l {Qt Concurrent} framework. QFuture allows threads to be synchronized against one or more results which will be ready at a later point in time. The result can be of any type @@ -93,7 +92,7 @@ To interact with running tasks using signals and slots, use QFutureWatcher. - \sa QFutureWatcher, {Concurrent Programming}{Qt Concurrent} + \sa QFutureWatcher, {Qt Concurrent} */ /*! \fn QFuture::QFuture() diff --git a/src/corelib/thread/qfuturesynchronizer.qdoc b/src/corelib/thread/qfuturesynchronizer.qdoc index 7ad978f61d..cc31dff46d 100644 --- a/src/corelib/thread/qfuturesynchronizer.qdoc +++ b/src/corelib/thread/qfuturesynchronizer.qdoc @@ -66,7 +66,7 @@ You can query the status of the cancel-on-wait feature using the cancelOnWait() function. - \sa QFuture, QFutureWatcher, {Concurrent Programming}{Qt Concurrent} + \sa QFuture, QFutureWatcher, {Qt Concurrent} */ /*! diff --git a/src/corelib/thread/qfuturewatcher.cpp b/src/corelib/thread/qfuturewatcher.cpp index 53a00a8212..a7f2dd9f73 100644 --- a/src/corelib/thread/qfuturewatcher.cpp +++ b/src/corelib/thread/qfuturewatcher.cpp @@ -98,7 +98,7 @@ QT_BEGIN_NAMESPACE QFutureWatcher as well. This is useful if only status or progress information is needed; not the actual result data. - \sa QFuture, {Concurrent Programming}{Qt Concurrent} + \sa QFuture, {Qt Concurrent} */ /*! \fn QFutureWatcher::QFutureWatcher(QObject *parent) -- cgit v1.2.3 From 3ec52de5e96c332a207b48c8a7655d3fdfc5edb8 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 15 Sep 2013 15:41:59 +0200 Subject: Fix QSqlDriver::handle casting examples QVariant::typeName() returns a const char *, so one can't use == to compare it against another string. Change-Id: Id7a4c06a9e4874459609b3749f87d39ed73e8405 Reviewed-by: Stephen Kelly --- src/sql/doc/snippets/code/src_sql_kernel_qsqldriver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sql/doc/snippets/code/src_sql_kernel_qsqldriver.cpp b/src/sql/doc/snippets/code/src_sql_kernel_qsqldriver.cpp index 55b17c05eb..d0b825ac21 100644 --- a/src/sql/doc/snippets/code/src_sql_kernel_qsqldriver.cpp +++ b/src/sql/doc/snippets/code/src_sql_kernel_qsqldriver.cpp @@ -52,12 +52,12 @@ if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*")==0) { //! [1] -if (v.typeName() == "PGconn*") { +if (qstrcmp(v.typeName(), "PGconn*")) { PGconn *handle = *static_cast(v.data()); if (handle != 0) ... } -if (v.typeName() == "MYSQL*") { +if (qstrcmp(v.typeName(), "MYSQL*")) { MYSQL *handle = *static_cast(v.data()); if (handle != 0) ... } -- cgit v1.2.3 From 117880499754b14bbada9646b85feef066d7b959 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 16 Sep 2013 19:00:40 +0200 Subject: HTTP authentication fails if QUrl contains password with % Default for QUrl::password() and QUrl::userName() is in Qt 5.1 QUrl::PrettyDecoded which means the return value may contain percent-encodings. For authentication we need the real decoded result, and should instead use QUrl::FullyDecoded. Note this bug has already been fixed indirectly in Qt 5.2 since the default for the two methods was changed to QUrl::FullyDecoded. Change-Id: Ia0f38c073cb001e37ad8b3eda40b3db756bec3dc Reviewed-by: Thiago Macieira --- src/network/access/qhttpnetworkconnectionchannel.cpp | 4 ++-- src/network/access/qnetworkaccessmanager.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index e14f426583..56984d144e 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -222,8 +222,8 @@ bool QHttpNetworkConnectionChannel::sendRequest() QAuthenticator &auth = authenticator; if (url.userName() != auth.user() || (!url.password().isEmpty() && url.password() != auth.password())) { - auth.setUser(url.userName()); - auth.setPassword(url.password()); + auth.setUser(url.userName(QUrl::FullyDecoded)); + auth.setPassword(url.password(QUrl::FullyDecoded)); connection->d_func()->copyCredentials(connection->d_func()->indexOf(socket), &auth, false); } // clear the userinfo, since we use the same request for resending diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 10d19bb7aa..b86efb21a8 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1229,8 +1229,8 @@ void QNetworkAccessManagerPrivate::authenticationRequired(QAuthenticator *authen // if credentials are included in the url, then use them if (!url.userName().isEmpty() && !url.password().isEmpty()) { - authenticator->setUser(url.userName()); - authenticator->setPassword(url.password()); + authenticator->setUser(url.userName(QUrl::FullyDecoded)); + authenticator->setPassword(url.password(QUrl::FullyDecoded)); *urlForLastAuthentication = url; authenticationManager->cacheCredentials(url, authenticator); return; -- cgit v1.2.3 From 8f46cb3ade5a57506afcd1589e489bbcf38ca7f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 27 Aug 2013 12:43:16 +0200 Subject: Keep Cocoa screen list in sync on screen connect. The backtrace in QTBUG-33012 indicates that the screen list is getting out of sync on plugging/unplugging an external monitor. This happens on 10.9 only. Check if we are about to out of bounds access the screen list; call updateScreens() which will add the new screen. Task-number: QTBUG-33012 Change-Id: Id1acc3baca9e60e7f2a83188d66cdf9d322a582c Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qcocoaintegration.h | 2 +- src/plugins/platforms/cocoa/qcocoaintegration.mm | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index 7831888da1..8620ef4267 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -125,7 +125,7 @@ public: QList possibleKeys(const QKeyEvent *event) const; void updateScreens(); - QCocoaScreen *screenAtIndex(int index) const { return mScreens.at(index); } + QCocoaScreen *screenAtIndex(int index); private: diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index fad743439e..5f0ad24241 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -343,6 +343,14 @@ void QCocoaIntegration::updateScreens() screen->setVirtualSiblings(siblings); } +QCocoaScreen *QCocoaIntegration::screenAtIndex(int index) +{ + if (index >= mScreens.count()) + updateScreens(); + + return mScreens.at(index); +} + bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const { switch (cap) { -- cgit v1.2.3 From ddecbae5e149d2a8e16af630f158f832869f5d97 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 12 Sep 2013 14:23:57 +0200 Subject: Initialize the print panel with the NSPrintInfo we have created Since the Cocoa Print Panel was not initialized with the NSPrintInfo we had created, it meant that it did get any of the settings from the print dialog as it was trying to access an invalid NSPrintInfo. Task-number: QTBUG-32734 Change-Id: I23c766eb13281f4c494656a54d37c5bf28fb68fd Reviewed-by: John Layt --- src/printsupport/dialogs/qprintdialog_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/printsupport/dialogs/qprintdialog_mac.mm b/src/printsupport/dialogs/qprintdialog_mac.mm index 9839268af4..37333f2593 100644 --- a/src/printsupport/dialogs/qprintdialog_mac.mm +++ b/src/printsupport/dialogs/qprintdialog_mac.mm @@ -197,7 +197,7 @@ void QPrintDialogPrivate::openCocoaPrintPanel(Qt::WindowModality modality) // close down during the cleanup (QTBUG-17913): qApp->processEvents(QEventLoop::ExcludeUserInputEvents, QEventLoop::ExcludeSocketNotifiers); - QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] init]; + QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QCocoaPrintPanelDelegate) alloc] initWithNSPrintInfo:printInfo]; if (modality == Qt::ApplicationModal || !q->parentWidget()) { if (modality == Qt::NonModal) qWarning("QPrintDialog is required to be modal on OS X"); -- cgit v1.2.3 From 97279d05822a70da1fb3dab083d823a5f5a008fe Mon Sep 17 00:00:00 2001 From: "H. Rittich" Date: Fri, 13 Sep 2013 17:28:23 +0200 Subject: Fix sigchld-Handler Changed the sigchld-Handler such that the SA_SIGINFO flag is handeled correctly. Furthermore the signal mask is preserved such that the original signal handler is not interrupted when not allowed. Task-number: QTBUG-32979 Change-Id: Iec7663e7289ea5d95155f52cf8788ebf646cfabd Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess_unix.cpp | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index e9957d2384..7e42f4b722 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -121,17 +121,33 @@ static const int errorBufferMax = 512; static int qt_qprocess_deadChild_pipe[2]; static struct sigaction qt_sa_old_sigchld_handler; -static void qt_sa_sigchld_handler(int signum) +static void qt_sa_sigchld_sigaction(int signum, siginfo_t *info, void *context) { + // *Never* use the info or contect variables in this function + // (except for passing them to the next signal in the chain). + // We cannot be sure if another library or if the application + // installed a signal handler for SIGCHLD without SA_SIGINFO + // and fails to pass the arguments to us. If they do that, + // these arguments contain garbage and we'd most likely crash. + qt_safe_write(qt_qprocess_deadChild_pipe[1], "", 1); #if defined (QPROCESS_DEBUG) fprintf(stderr, "*** SIGCHLD\n"); #endif - // load it as volatile - void (*oldAction)(int) = ((volatile struct sigaction *)&qt_sa_old_sigchld_handler)->sa_handler; - if (oldAction && oldAction != SIG_IGN) - oldAction(signum); + // load as volatile + volatile struct sigaction *vsa = &qt_sa_old_sigchld_handler; + + if (qt_sa_old_sigchld_handler.sa_flags & SA_SIGINFO) { + void (*oldAction)(int, siginfo_t *, void *) = vsa->sa_sigaction; + + oldAction(signum, info, context); + } else { + void (*oldAction)(int) = vsa->sa_handler; + + if (oldAction && oldAction != SIG_IGN) + oldAction(signum); + } } static inline void add_fd(int &nfds, int fd, fd_set *fdset) @@ -197,10 +213,16 @@ QProcessManager::QProcessManager() // set up the SIGCHLD handler, which writes a single byte to the dead // child pipe every time a child dies. + struct sigaction action; - memset(&action, 0, sizeof(action)); - action.sa_handler = qt_sa_sigchld_handler; - action.sa_flags = SA_NOCLDSTOP; + // use the old handler as template, i.e., preserve the signal mask + // otherwise the original signal handler might be interrupted although it + // was marked to never be interrupted + ::sigaction(SIGCHLD, NULL, &action); + action.sa_sigaction = qt_sa_sigchld_sigaction; + // set the SA_SIGINFO flag such that we can use the three argument handler + // function + action.sa_flags = SA_NOCLDSTOP | SA_SIGINFO; ::sigaction(SIGCHLD, &action, &qt_sa_old_sigchld_handler); processManagerInstance = this; @@ -225,7 +247,7 @@ QProcessManager::~QProcessManager() struct sigaction currentAction; ::sigaction(SIGCHLD, 0, ¤tAction); - if (currentAction.sa_handler == qt_sa_sigchld_handler) { + if (currentAction.sa_sigaction == qt_sa_sigchld_sigaction) { ::sigaction(SIGCHLD, &qt_sa_old_sigchld_handler, 0); } -- cgit v1.2.3 From 18a08ab8a1c7b88a1b43b8eb54e899a36f70a458 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 16 Sep 2013 23:06:02 +0200 Subject: Add missing initialization before requesting png data for scaled read Initialize all values read to sensible default in case reading them fails in read_image_scaled. It has already been done for a normal image read Task-number: QTBUG-32674 Change-Id: I19dccad7ef342f1b1bba6b513c04d3661d128a54 Reviewed-by: aavit --- src/gui/image/qpnghandler.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 7838b7df8e..4b016782b1 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2013 Samuel Gaist ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** @@ -406,14 +407,14 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i QPngHandlerPrivate::AllocatedMemoryPointers &, QSize scaledSize) { - png_uint_32 width; - png_uint_32 height; - png_int_32 offset_x; - png_int_32 offset_y; + png_uint_32 width = 0; + png_uint_32 height = 0; + png_int_32 offset_x = 0; + png_int_32 offset_y = 0; - int bit_depth; - int color_type; - int unit_type; + int bit_depth = 0; + int color_type = 0; + int unit_type = PNG_OFFSET_PIXEL; png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type); uchar *data = outImage->bits(); -- cgit v1.2.3 From 73b88fccedfe3912649d119bedf8490ab6c41812 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 17 Sep 2013 22:22:30 +0200 Subject: PNG: properly handle 1bpp greyscale images with alpha PNG allows 1bpp greyscale images (PNG_COLOR_TYPE_GRAY) to have an alpha key; so even in this case we need to inquiry if the image has a transparency, and if so modify the color table of the monochrome image accordingly. Task-number: QTBUG-33503 Change-Id: Iab07c8f95ac8865269c48816e222645cdcb6bbc1 Reviewed-by: Nicolas Arnaud-Cormos Reviewed-by: aavit --- src/gui/image/qpnghandler.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 4b016782b1..3ee9e200de 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -281,6 +281,15 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, QSize scal image.setColorCount(2); image.setColor(1, qRgb(0,0,0)); image.setColor(0, qRgb(255,255,255)); + if (png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans, &trans_color_p) && trans_color_p) { + const int g = trans_color_p->gray; + // the image has white in the first position of the color table, + // black in the second. g is 0 for black, 1 for white. + if (g == 0) + image.setColor(1, qRgba(0, 0, 0, 0)); + else if (g == 1) + image.setColor(0, qRgba(255, 255, 255, 0)); + } } else if (bit_depth == 16 && png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { png_set_expand(png_ptr); png_set_strip_16(png_ptr); -- cgit v1.2.3 From 31db8728cf038f0a38c42d64c375403fde8598c9 Mon Sep 17 00:00:00 2001 From: Riccardo Ferrazzo Date: Thu, 29 Aug 2013 12:36:34 +0200 Subject: Fix QFileSystemWatcher inotify On linux using QFileSystemWatcher with inotify backend when a watched file is moved and added again to the watched files its path is not replaced with the new one. This behavior prevents the emission of the fileChanged signal with the wrong file path. Task-number: QTBUG-33211 Change-Id: Ib45d8efdf5afbf8b8f6b4b26e43f3d6ee740aca6 Reviewed-by: Thiago Macieira --- src/corelib/io/qfilesystemwatcher_inotify.cpp | 21 +++++++++++++++++---- src/corelib/io/qfilesystemwatcher_inotify_p.h | 5 ++++- 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 024af79c33..c731f3d417 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -365,11 +365,11 @@ void QInotifyFileSystemWatcherEngine::readFromInotify() // qDebug() << "inotify event, wd" << event.wd << "mask" << hex << event.mask; int id = event.wd; - QString path = idToPath.value(id); + QString path = getPathFromID(id); if (path.isEmpty()) { // perhaps a directory? id = -id; - path = idToPath.value(id); + path = getPathFromID(id); if (path.isEmpty()) continue; } @@ -378,8 +378,9 @@ void QInotifyFileSystemWatcherEngine::readFromInotify() if ((event.mask & (IN_DELETE_SELF | IN_MOVE_SELF | IN_UNMOUNT)) != 0) { pathToID.remove(path); - idToPath.remove(id); - inotify_rm_watch(inotifyFd, event.wd); + idToPath.remove(id, getPathFromID(id)); + if (!idToPath.contains(id)) + inotify_rm_watch(inotifyFd, event.wd); if (id < 0) emit directoryChanged(path, true); @@ -394,6 +395,18 @@ void QInotifyFileSystemWatcherEngine::readFromInotify() } } +QString QInotifyFileSystemWatcherEngine::getPathFromID(int id) const +{ + QHash::const_iterator i = idToPath.find(id); + while (i != idToPath.constEnd() && i.key() == id) { + if ((i + 1) == idToPath.constEnd() || (i + 1).key() != id) { + return i.value(); + } + ++i; + } + return QString(); +} + QT_END_NAMESPACE #endif // QT_NO_FILESYSTEMWATCHER diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h index 959d9edc12..d02f04eed6 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify_p.h +++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h @@ -78,11 +78,14 @@ public: private Q_SLOTS: void readFromInotify(); +private: + QString getPathFromID(int id) const; + private: QInotifyFileSystemWatcherEngine(int fd, QObject *parent); int inotifyFd; QHash pathToID; - QHash idToPath; + QMultiHash idToPath; QSocketNotifier notifier; }; -- cgit v1.2.3 From fdd843d5a76f2bba5c4ebdd5813c97f5105c5765 Mon Sep 17 00:00:00 2001 From: Balazs Domjan Date: Thu, 22 Aug 2013 15:37:17 +0200 Subject: Fix transform (rotation matrix) uniform scale testing. The rotation matrix is different according to the order of scale and rotate operations. The fix takes into account this. Task-number: QTBUG-31822 Change-Id: Ia1c9068e54966ec083af9c165af29caa87c510f6 Reviewed-by: Gunnar Sletta --- src/gui/painting/qtransform.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 5088e9cdc8..a07b5def5d 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -2293,13 +2293,30 @@ bool qt_scaleForTransform(const QTransform &transform, qreal *scale) return qFuzzyCompare(xScale, yScale); } - const qreal xScale = transform.m11() * transform.m11() + // rotate then scale: compare columns + const qreal xScale1 = transform.m11() * transform.m11() + transform.m21() * transform.m21(); - const qreal yScale = transform.m12() * transform.m12() + const qreal yScale1 = transform.m12() * transform.m12() + transform.m22() * transform.m22(); - if (scale) - *scale = qSqrt(qMax(xScale, yScale)); - return type == QTransform::TxRotate && qFuzzyCompare(xScale, yScale); + + // scale then rotate: compare rows + const qreal xScale2 = transform.m11() * transform.m11() + + transform.m12() * transform.m12(); + const qreal yScale2 = transform.m21() * transform.m21() + + transform.m22() * transform.m22(); + + // decide the order of rotate and scale operations + if (qAbs(xScale1 - yScale1) > qAbs(xScale2 - yScale2)) { + if (scale) + *scale = qSqrt(qMax(xScale1, yScale1)); + + return type == QTransform::TxRotate && qFuzzyCompare(xScale1, yScale1); + } else { + if (scale) + *scale = qSqrt(qMax(xScale2, yScale2)); + + return type == QTransform::TxRotate && qFuzzyCompare(xScale2, yScale2); + } } QT_END_NAMESPACE -- cgit v1.2.3 From bc6f5b3ff61f4b1dea14084349702f2895feda66 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 9 Sep 2013 14:20:50 +0200 Subject: Implement INCR property mechanism for large data transfers [XCB] Implement INCR property mechanism according to the icccm specification. Change-Id: Ic8f85b71cab825d70ee1b61f29acd09fa4c3e642 Reviewed-by: Lars Knoll --- src/plugins/platforms/xcb/qxcbclipboard.cpp | 130 ++++++++++++++++++++++++++- src/plugins/platforms/xcb/qxcbclipboard.h | 6 ++ src/plugins/platforms/xcb/qxcbconnection.cpp | 6 ++ 3 files changed, 138 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index ab48d18af4..dab4f443ff 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -157,12 +157,121 @@ private: QByteArray format_atoms; }; +class INCRTransaction; +typedef QMap TransactionMap; +static TransactionMap *transactions = 0; + +//#define INCR_DEBUG + +class INCRTransaction : public QObject +{ + Q_OBJECT +public: + INCRTransaction(QXcbConnection *c, xcb_window_t w, xcb_atom_t p, + QByteArray d, uint i, xcb_atom_t t, int f, int to) : + conn(c), win(w), property(p), data(d), increment(i), + target(t), format(f), timeout(to), offset(0) + { + const quint32 values[] = { XCB_EVENT_MASK_PROPERTY_CHANGE }; + xcb_change_window_attributes(conn->xcb_connection(), win, + XCB_CW_EVENT_MASK, values); + if (!transactions) { +#ifdef INCR_DEBUG + qDebug("INCRTransaction: creating the TransactionMap"); +#endif + transactions = new TransactionMap; + conn->clipboard()->setProcessIncr(true); + } + transactions->insert(win, this); + abort_timer = startTimer(timeout); + } + + ~INCRTransaction() + { + if (abort_timer) + killTimer(abort_timer); + abort_timer = 0; + transactions->remove(win); + if (transactions->isEmpty()) { +#ifdef INCR_DEBUG + qDebug("INCRTransaction: no more INCR transactions left in the TransactionMap"); +#endif + delete transactions; + transactions = 0; + conn->clipboard()->setProcessIncr(false); + } + } + + void updateIncrProperty(xcb_property_notify_event_t *event, bool &accepted) + { + xcb_connection_t *c = conn->xcb_connection(); + if (event->atom == property && event->state == XCB_PROPERTY_DELETE) { + accepted = true; + // restart the timer + if (abort_timer) + killTimer(abort_timer); + abort_timer = startTimer(timeout); + + unsigned int bytes_left = data.size() - offset; + if (bytes_left > 0) { + unsigned int bytes_to_send = qMin(increment, bytes_left); +#ifdef INCR_DEBUG + qDebug("INCRTransaction: sending %d bytes, %d remaining (INCR transaction %p)", + bytes_to_send, bytes_left - bytes_to_send, this); +#endif + int dataSize = bytes_to_send / (format / 8); + xcb_change_property(c, XCB_PROP_MODE_REPLACE, win, property, + target, format, dataSize, data.constData() + offset); + offset += bytes_to_send; + } else { +#ifdef INCR_DEBUG + qDebug("INCRTransaction: INCR transaction %p completed", this); +#endif + xcb_change_property(c, XCB_PROP_MODE_REPLACE, win, property, + target, format, 0, (const void *)0); + const quint32 values[] = { XCB_EVENT_MASK_NO_EVENT }; + xcb_change_window_attributes(conn->xcb_connection(), win, + XCB_CW_EVENT_MASK, values); + // self destroy + delete this; + } + } + } + +protected: + void timerEvent(QTimerEvent *ev) + { + if (ev->timerId() == abort_timer) { + // this can happen when the X client we are sending data + // to decides to exit (normally or abnormally) +#ifdef INCR_DEBUG + qDebug("INCRTransaction: Timed out while sending data to %p", this); +#endif + delete this; + } + } + +private: + QXcbConnection *conn; + xcb_window_t win; + xcb_atom_t property; + QByteArray data; + uint increment; + xcb_atom_t target; + int format; + int timeout; + uint offset; + int abort_timer; +}; + const int QXcbClipboard::clipboard_timeout = 5000; QXcbClipboard::QXcbClipboard(QXcbConnection *c) : QXcbObject(c), QPlatformClipboard() , m_requestor(XCB_NONE) , m_owner(XCB_NONE) + , m_incr_active(false) + , m_clipboard_closing(false) { Q_ASSERT(QClipboard::Clipboard == 0); Q_ASSERT(QClipboard::Selection == 1); @@ -200,6 +309,7 @@ QXcbClipboard::QXcbClipboard(QXcbConnection *c) QXcbClipboard::~QXcbClipboard() { + m_clipboard_closing = true; // Transfer the clipboard content to the clipboard manager if we own a selection if (m_timestamp[QClipboard::Clipboard] != XCB_CURRENT_TIME || m_timestamp[QClipboard::Selection] != XCB_CURRENT_TIME) { @@ -224,6 +334,17 @@ QXcbClipboard::~QXcbClipboard() } } +void QXcbClipboard::incrTransactionPeeker(xcb_generic_event_t *ge, bool &accepted) +{ + uint response_type = ge->response_type & ~0x80; + if (response_type == XCB_PROPERTY_NOTIFY) { + xcb_property_notify_event_t *event = (xcb_property_notify_event_t *)ge; + TransactionMap::Iterator it = transactions->find(event->window); + if (it != transactions->end()) { + (*it)->updateIncrProperty(event, accepted); + } + } +} xcb_window_t QXcbClipboard::getSelectionOwner(xcb_atom_t atom) const { @@ -415,16 +536,17 @@ xcb_atom_t QXcbClipboard::sendSelection(QMimeData *d, xcb_atom_t target, xcb_win // Motif clients (since Motif doesn't support INCR) static xcb_atom_t motif_clip_temporary = atom(QXcbAtom::CLIP_TEMPORARY); bool allow_incr = property != motif_clip_temporary; - + // This 'bool' can be removed once there is a proper fix for QTBUG-32853 + if (m_clipboard_closing) + allow_incr = false; // X_ChangeProperty protocol request is 24 bytes const int increment = (xcb_get_maximum_request_length(xcb_connection()) * 4) - 24; if (data.size() > increment && allow_incr) { long bytes = data.size(); xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, window, property, atom(QXcbAtom::INCR), 32, 1, (const void *)&bytes); - -// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); - qWarning("QXcbClipboard: INCR is unimplemented"); + new INCRTransaction(connection(), window, property, data, increment, + atomFormat, dataFormat, clipboard_timeout); return property; } diff --git a/src/plugins/platforms/xcb/qxcbclipboard.h b/src/plugins/platforms/xcb/qxcbclipboard.h index 61cdce3d1d..c94762d80f 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.h +++ b/src/plugins/platforms/xcb/qxcbclipboard.h @@ -83,6 +83,10 @@ public: QByteArray getDataInFormat(xcb_atom_t modeAtom, xcb_atom_t fmtatom); + void setProcessIncr(bool process) { m_incr_active = process; } + bool processIncr() { return m_incr_active; } + void incrTransactionPeeker(xcb_generic_event_t *ge, bool &accepted); + xcb_window_t getSelectionOwner(xcb_atom_t atom) const; QByteArray getSelection(xcb_atom_t selection, xcb_atom_t target, xcb_atom_t property, xcb_timestamp_t t = 0); @@ -107,6 +111,8 @@ private: static const int clipboard_timeout; + bool m_incr_active; + bool m_clipboard_closing; }; #endif // QT_NO_CLIPBOARD diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 2ce34ea8f2..bb9922c5a1 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1154,6 +1154,12 @@ void QXcbConnection::processXcbEvents() continue; } + bool accepted = false; + if (clipboard()->processIncr()) + clipboard()->incrTransactionPeeker(event, accepted); + if (accepted) + continue; + QVector::iterator it = m_peekFuncs.begin(); while (it != m_peekFuncs.end()) { // These callbacks return true if the event is what they were -- cgit v1.2.3 From 663c5186e88e86983532b8010688b38221faab72 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 7 Aug 2013 13:46:21 +0200 Subject: Fix timing issue in incremental data retrieval mechanism Make sure that we are not reading wrong PropertyNotify events. From icccm: Requestors may receive a property of type INCR in response to any target that results in selection data. This indicates that the owner will send the actual data incrementally. The selection requestor: - Waits for the SelectionNotify event. - Loops: + Retrieving data using GetProperty with the delete argument True. + Waiting for a PropertyNotify with the state argument NewValue. - Waits until the property named by the PropertyNotify event is zero-length. - Deletes the zero-length property. The issue with the current approach was that after receiving INCR we simply fetched the first PropertyNotify event from the queue, where timestamp indicates that it was generated before INCR, which is not what need. We need PropertyNotify events with a timestamp older than the one on INCR. Task-number: QTBUG-32045 Change-Id: I3b9a006f7d346f67c51e1a296d67a9dc89efadb1 Reviewed-by: Lars Knoll --- src/plugins/platforms/xcb/qxcbclipboard.cpp | 15 +++++++++++---- src/plugins/platforms/xcb/qxcbclipboard.h | 3 ++- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index dab4f443ff..dd292fd2a3 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -272,6 +272,7 @@ QXcbClipboard::QXcbClipboard(QXcbConnection *c) , m_owner(XCB_NONE) , m_incr_active(false) , m_clipboard_closing(false) + , m_incr_receive_time(0) { Q_ASSERT(QClipboard::Clipboard == 0); Q_ASSERT(QClipboard::Selection == 1); @@ -733,7 +734,7 @@ static inline int maxSelectionIncr(xcb_connection_t *c) return (l > 65536 ? 65536*4 : l*4) - 100; } -bool QXcbClipboard::clipboardReadProperty(xcb_window_t win, xcb_atom_t property, bool deleteProperty, QByteArray *buffer, int *size, xcb_atom_t *type, int *format) const +bool QXcbClipboard::clipboardReadProperty(xcb_window_t win, xcb_atom_t property, bool deleteProperty, QByteArray *buffer, int *size, xcb_atom_t *type, int *format) { int maxsize = maxSelectionIncr(xcb_connection()); ulong bytes_left; // bytes_after @@ -809,7 +810,8 @@ bool QXcbClipboard::clipboardReadProperty(xcb_window_t win, xcb_atom_t property, // correct size, not 0-term. if (size) *size = buffer_offset; - + if (*type == atom(QXcbAtom::INCR)) + m_incr_receive_time = connection()->getTimestamp(); if (deleteProperty) xcb_delete_property(xcb_connection(), win, property); @@ -913,6 +915,7 @@ QByteArray QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb bool alloc_error = false; int length; int offset = 0; + xcb_timestamp_t prev_time = m_incr_receive_time; if (nbytes > 0) { // Reserve buffer + zero-terminator (for text data) @@ -927,10 +930,14 @@ QByteArray QXcbClipboard::clipboardReadIncrementalProperty(xcb_window_t win, xcb xcb_generic_event_t *ge = waitForClipboardEvent(win, XCB_PROPERTY_NOTIFY, clipboard_timeout); if (!ge) break; - xcb_property_notify_event_t *event = (xcb_property_notify_event_t *)ge; - if (event->atom != property || event->state != XCB_PROPERTY_NEW_VALUE) + + if (event->atom != property + || event->state != XCB_PROPERTY_NEW_VALUE + || event->time < prev_time) continue; + prev_time = event->time; + if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { if (length == 0) { // no more data, we're done if (nullterm) { diff --git a/src/plugins/platforms/xcb/qxcbclipboard.h b/src/plugins/platforms/xcb/qxcbclipboard.h index c94762d80f..03021aa606 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.h +++ b/src/plugins/platforms/xcb/qxcbclipboard.h @@ -78,7 +78,7 @@ public: void handleSelectionClearRequest(xcb_selection_clear_event_t *event); void handleXFixesSelectionRequest(xcb_xfixes_selection_notify_event_t *event); - bool clipboardReadProperty(xcb_window_t win, xcb_atom_t property, bool deleteProperty, QByteArray *buffer, int *size, xcb_atom_t *type, int *format) const; + bool clipboardReadProperty(xcb_window_t win, xcb_atom_t property, bool deleteProperty, QByteArray *buffer, int *size, xcb_atom_t *type, int *format); QByteArray clipboardReadIncrementalProperty(xcb_window_t win, xcb_atom_t property, int nbytes, bool nullterm); QByteArray getDataInFormat(xcb_atom_t modeAtom, xcb_atom_t fmtatom); @@ -113,6 +113,7 @@ private: bool m_incr_active; bool m_clipboard_closing; + xcb_timestamp_t m_incr_receive_time; }; #endif // QT_NO_CLIPBOARD -- cgit v1.2.3 From a23ff58d716f62b02ec825a3ea3c6b07616ee3f0 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 17 Sep 2013 16:01:52 +0200 Subject: OAuth over XMLHttpRequest fails We currently always generate our own Authorization header, which overrides any Authorization headers set the by user application. Change-Id: I3b11c8dd0bc708e795ff697262a383ce28cae2f3 Reviewed-by: Peter Hartmann --- src/network/access/qhttpnetworkconnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index a279990f4c..0222b36c7d 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -507,7 +507,7 @@ void QHttpNetworkConnectionPrivate::createAuthorization(QAbstractSocket *socket, // Send "Authorization" header, but not if it's NTLM and the socket is already authenticated. if (channels[i].authMethod != QAuthenticatorPrivate::None) { - if (!(channels[i].authMethod == QAuthenticatorPrivate::Ntlm && channels[i].lastStatus != 401)) { + if ((channels[i].authMethod != QAuthenticatorPrivate::Ntlm && request.headerField("Authorization").isEmpty()) || channels[i].lastStatus == 401) { QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(channels[i].authenticator); if (priv && priv->method != QAuthenticatorPrivate::None) { QByteArray response = priv->calculateResponse(request.d->methodName(), request.d->uri(false)); -- cgit v1.2.3