summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_win.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QProcess: set the error message and state if qt_create_pipe() failsThiago Macieira2024-02-261-5/+21
| | | | | | | | | | | | | | | | | | | | It can only happen on resource exhaustion, which is an unlikely situation. That's probably why we didn't handle this case. But let's do it now. This necessitated that qt_create_pipe() return with errno/GetLastError() properly set, so save it and restore around functions that may change it (like qErrnoWarning()). Drive-by update of some warning messages. Testing this is not practical and is fragile, because it requires causing the resource exhaustion problem. Pick-to: 6.6 6.7 Change-Id: I76ffba14ece04f24b43efffd17aafe4f11f54c21 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcess: align treatment of early start errorsThiago Macieira2024-01-221-3/+2
| | | | | | | | | | | | | | | | There are a couple of possible runtime errors that could happen before the state was changed to QProcess::Starting. This aligns the Unix code with Windows, which has the state transition at the top, and with the documentation which says we will enter QProcess::Starting state. Complements commit 956b2495285251e4840ec32885ffa2cfbb7bd79c, repeating what it did for Unix (removing the overwriting of the error message that openChannel() sets) on Windows. We also need to ensure cleanup() is always called. Pick-to: 6.6 6.7 Change-Id: I76ffba14ece04f24b43efffd17aafdd47f908bf1 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QProcessPrivate: remove the member variable "crashed"Thiago Macieira2023-05-131-3/+8
| | | | | | | | | | | | | It was only used to later set exitStatus = CrashExit, so simply do it early. Drive-by removal of a magic numeric literal in the middle of the source code. It's still magic, but at least we avoid accidentally making typos. Pick-to: 6.5 Change-Id: Icfe44ecf285a480fafe4fffd174d4176a5d87641 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-39/+3
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtCore: replace QLatin1String/QLatin1Char with _L1/u'' where applicableSona Kurazyan2022-03-251-17/+19
| | | | | | | | | | | As a drive-by, did also minor refactorings/improvements. Task-number: QTBUG-98434 Change-Id: I81964176ae2f07ea63674c96f47f9c6aa046854f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
* QProcess(Win): change int to qsizetype where appropriateMårten Nordheim2022-02-051-4/+4
| | | | | | | | | Even if it's unlikely any of those would exceed 2 billion entries. Pick-to: 6.3 6.2 Change-Id: Ib0d4d4e7a64fcde03b7f24bc0667d63c4a737deb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Replace QString::utf16() with data() in memcpy() and QByteArray ctorØystein Heskestad2022-01-071-2/+2
| | | | | | | | | | | QString::utf16() needlessly detaches fromRawData() to ensure a terminating NUL. Use data() where we don't require said NUL, taking care not to call the mutable data() overload, which would detach, too. Task-number: QTBUG-98763 Change-Id: I7075a8f18ab1f82ebbcf8cfab1643e8ab7f38d51 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QProcess: Distinguish between null and empty QProcessEnvironmentIevgenii Meshcheriakov2021-11-071-48/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation for QProcessEnvironment's default constructor says: This constructor creates an empty environment. If set on a QProcess, this will cause the current environment variables to be removed. This is not the case however, because setting such an environment for a process is equivalent to not setting an environment at all and the child process is executed with parent's environment. It is still possible starting from Qt 6.2.0 to create an empty environment by adding a variable to a null environment and removing it, but that's cumbersome, and the comparison operator says that it is equal to the null environment but it is obviously behaving in a different way. This change adds an additional constructor to QProcessEnvironment that can be used to construct a null environment, and changes the default constructor to produce an empty environment. The comparison operator is changed to correctly distinguish between such objects. This is a behavior change, but the current behavior is broken and this is unlikely to affect working code. [ChangeLog][QtCore][QProcessEnvironment] An additional constructor was added to explicitly create an object that when set on QProcess would cause it to inherit the environment from parent (this was formerly the behavior of a default-constructed QProcessEnvironment, which will now (as documented) actually give a process an environment with no variables set). A new method inheritsFromParent() was added to test for such objects. Fixes: QTBUG-58053 Change-Id: I15e20c6a5f01ebe2c736d5578c75dba1ee319320 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove pre-Win10 code paths in QtBaseYuhang Zhao2021-11-021-9/+1
| | | | | | | | | | | | | | Mostly a removal of dynamically loaded API. They should all exist on Windows 10 1809 (Qt6's minimum supported version). accessibility parts left untouched to make sure MinGW still compiles. Task-number: QTBUG-84432 Pick-to: 6.2 Change-Id: I7a091fc967bd6b9d18ac2de39db16e3b4b9a76ea Reviewed-by: André de la Rocha <andre.rocha@qt.io>
* corelib: Fix typos in source code commentsJonas Kvinge2021-10-121-1/+1
| | | | | | Pick-to: 6.2 Change-Id: Ic78afb67143112468c6f84677ac88f27a74b53aa Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Q{LocalSocket|Process}/Win: handle write errorsAlex Trotsenko2021-09-181-0/+8
| | | | | | | | | To match the Unix behavior, we should emit errorOccurred() signal and close the channel if the write operation fails. Change-Id: Iac3acb18dbbfe6e7e8afb2555d9adaff1fe98d0f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QWindowsPipeWriter: do not clear the buffer in thread pool callbackAlex Trotsenko2021-09-181-2/+1
| | | | | | | | | | | | | | | | | In a blocking application, receiving the results of write operations must be synchronized with the waitFor...() functions. But, clearing the buffer in another thread can cause the code localsocket.write(...); QVERIFY(localsocket.bytesToWrite() > 0); to fail unexpectedly, if the socket has been disconnected between the calls. So, defer resetting the buffer until checkForWrite() is called. Change-Id: I8c21036aab6a4c56d02c0d9a18d4bbce52d724f4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Doc: Fix documentation issues for Qt CoreTopi Reinio2021-08-241-0/+1
| | | | | | | | | | | | | | * Tag deprecated Q(Multi)Map operators in the header to correctly match them with documentation \fn commands. * Add documentation for QByteArrayView comparison operators. * Add a dummy typedef 'jfieldID' for generating docs correctly on non-Android platforms * Fix other minor issues Pick-to: 6.2 Task-number: QTBUG-95860 Change-Id: I141d2f75d6aa10557aa374201f09ad74b4cd6e81 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QProcess/Win: cleanup startProcess()Alex Trotsenko2021-06-191-17/+2
| | | | | | | | | Both the call to setProcessState(QProcess::NotRunning) and deleting the PROCESS_INFORMATION structure are redundant here. All this work was done by the previously executed cleanup() call. Change-Id: Iaf89f5edd2b661008a479d154e68974621b1b1eb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Win: avoid double buffering on writeAlex Trotsenko2021-06-181-53/+21
| | | | | | | | | | | | | As QWindowsPipeWriter now maintains a chunk queue, there is no need to use the internal QIODevice buffer and wait for the previous operation to complete. This also allows us to get rid of the stdinWriteTrigger timer; however, as a trade-off, QWindowsPipeWriter now needs to accept data even before a handle is assigned. Change-Id: I17fe0e36a6165fe05100bfab3fe01fc0d880d617 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Allow destruction of QWindowsPipeReader in its signalAlex Trotsenko2021-06-181-14/+7
| | | | | | | | As a result, we can refrain from using the deleteLater() technique in QProcess and avoid long-lived soft leaks in blocking applications. Change-Id: I89e02b02551a668b995ad3d12d3ce9575b2dd9dd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess: untangle platform-specific detailsAlex Trotsenko2021-06-041-2/+67
| | | | | | | | | - add missing #ifdef in header file; - split some functions (writeData(), _q_canWrite(), cleanup()) into their platform-specific implementations. Change-Id: I4e7c1c377ec8468ed120d38acf2543eef9316c01 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Introduce QProcessPrivate::closeChannels()Alex Trotsenko2021-05-311-6/+2
| | | | | | | Avoid duplicating code for both platforms. Change-Id: Iae00023672b63e8539cf824fa3aaaff2bf9ae0c5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QWindowsPipe{Reader|Writer}: restructure signalsAlex Trotsenko2021-04-151-4/+14
| | | | | | | | | | | | | | | | | | | For QProcess, there is no point in suppressing recursive QWPR::readyRead() emission, as the former manages this logic itself. On top of that, the non-recursive nature of QWPR::readyRead() indirectly disallowed reading from the channels inside QProcess::waitForReadyRead(), if that is called from a slot connected to QProcess::readyRead(). QWPW had two signals, one allowing recursion and one not. This commit allows recursion of QWPR::readyRead() and QWPW::bytesWritten(), and moves recursion suppression to the higher- level classes. This makes the code more uniform and efficient, at the cost of a few duplicated lines. Change-Id: Ib20017fff4d92403d0bf2335f1622de4aa1ddcef Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Win: do not use extended API for pollingAlex Trotsenko2021-03-291-4/+4
| | | | | | | | | We avoid entering an alertable wait state there, so calling WaitForSingleObject() instead of the ...Ex() analog would be appropriate. Change-Id: I7cd23805519f18b3174f66537dcf4c0da5061ca0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Win: get rid of incremental waitAlex Trotsenko2021-03-251-33/+79
| | | | | | | | Introduce QProcessPoller helper class on Windows that implements waiting for any activity from a child process. Change-Id: I99414db4424b4342e0fa3d7a3789f85cad76d190 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Win: simplify logic inside waitForBytesWritten()Alex Trotsenko2021-03-251-21/+6
| | | | | | | Also, remove obsolete comments and an unnecessary check. Change-Id: If64fa660d5434de94edfa48aafcaeb755aa8d68c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Win: implement async closing of write channelAlex Trotsenko2021-03-111-6/+0
| | | | | | | | | Instead of blocking in QProcessPrivate::closeWriteChannel(), we can handle a pending close in _q_canWrite() slot when there is no more data to write. Change-Id: I2a30789b6099a2ec075292348ebe33a11341bca3 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess::startDetached: set the error condition on failure to startThiago Macieira2021-02-211-0/+6
| | | | | | | | | | | | And set *pid to -1. [ChangeLog][QtCore][QProcess] If a startDetached() fails to start the target application, the QProcess object should now have a proper error string in errorString(). Pick-to: 6.1 Change-Id: Ic90d8429a0eb4837971dfffd1664e825ffcb923e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Win: move pipe draining into QWindowsPipeReaderAlex Trotsenko2021-01-221-19/+9
| | | | | | | | | | | | | | | | | | ... where it belongs. To avoid the loop, introduce the drainAndStop() function, which allows QWindowsPipeReader to flush the pipe itself. It determines the number of bytes pending and blocks until the remainder of the process output is received. Note that the loop in drainOutputPipes() didn't actually have to interleave the two pipes (because we're presuming that the operations will finish instantly), so we don't do it now. Also, the code violated the API contract: 'true' was returned when the 'wrong' channel received data; this is now fixed as a side effect. Change-Id: I38ed4861a238e39e793c3716e856e5bfdeed3d74 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Remove useless call in QProcessPrivate::waitForFinished() on WindowsAlex Trotsenko2021-01-091-3/+1
| | | | | | | | | if pid == nullptr, the child process has already exited and the pipe readers have been stopped. So the call to drainOutputPipes() is unnecessary here. Change-Id: I0bed90d08ac879bb0ae178a1cdc37afb9d825314 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Split QProcessPrivate::_q_processDied()Alex Trotsenko2021-01-091-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The completion of the child process can take place asynchronously or in one of the waitFor...() functions. In both cases, we used the same handler (_q_processDied()), which caused several problems: a. technically, waitForReadyRead() should have taken into account the result of the calls to _q_canRead...() slots inside the _q_processDied() function: - the user calls waitForReadyRead(); - forkfd descriptor becomes signaled, while a grandchild process is still alive; - as readyRead() signal has not been emitted, _q_processDied() is called; - the grandchild process writes to stdout pipe; - now data arrives, and _q_processDied() will collect it, but won't report it. b. we had a bug with recursions on Unix: - death notification comes asynchronously; - waitForDeadChild() closes forkfd; - _q_canRead...() emits readyRead(); - a slot connected to readyRead() calls waitForFinished(); - waitForFinished() hangs (forkfd == -1). c. for blocking functions, drainOutputPipes() was called twice on Windows. By introducing a new processFinished() function, we leave the read operations in the _q_processDied() slot, while the process completion code is guaranteed to run only once. Change-Id: I5f9d09bc68a058169de4d9e490b48fc0b35e94cd Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Win: do not duplicate handles for pipelined processesAlex Trotsenko2021-01-031-24/+8
| | | | | | | Instead, make them inheritable at creation time. Change-Id: I1aabc203851b2873acc772ba20258238cbe01d59 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess: allow merged channels forwarding for detached processesAlex Trotsenko2020-12-311-11/+1
| | | | | | | | [ChangeLog][QtCore][QProcess] Added support for QProcess::MergedChannels mode with startDetached(). Change-Id: I953ad2063322015332269522a297f8e2842e438c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess: consolidate channel managementAlex Trotsenko2020-12-311-25/+4
| | | | | | | | | | We have the same channel forwarding, redirecting, and merging rules for all platforms. This makes it possible to introduce the openChannels() function, which consolidates the logic and performs high-level general processing of the channels configuration properties. Change-Id: Id3574fc42a56829328369b6a1a6ec9c95fce8eca Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Win: do not needlessly duplicate std handles in startProcess()Alex Trotsenko2020-12-301-38/+34
| | | | | | | | | | | The idea was to create descriptors with HANDLE_FLAG_INHERIT. However, this can be assumed to be already the case for std descriptors, and if it isn't, the user messed up, and we shouldn't try to work around it. This is consistent with what we already do in startDetached(). Change-Id: I8135c5e612c361e77a0442541f2d50cfbb5b4601 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* QProcess/Win: handle more errors in openChannel()Alex Trotsenko2020-12-301-40/+46
| | | | | | | | | | | | In theory, low-level functions like CreateNamedPipe() or DuplicateHandle() could suddenly fail. Thus, in order to ensure the correct configuration of the channels, we must check for these errors. Pick-to: 6.0 5.15 Change-Id: I3d6291043e5e394ec5c5a7d85dfb7b09bfdcd172 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcess: migrate to QDeadlineTimerAlex Trotsenko2020-12-091-9/+8
| | | | | | | | | Replacing QElapsedTimer with QDeadlineTimer simplifies the code in waiting functions, which also improves readability. Change-Id: I56aedd356b547b6735ed0985dc81be706e292437 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcess/Win: improve reading in waitForBytesWritten()Alex Trotsenko2020-12-011-8/+2
| | | | | | | | | | | | | | | On Windows, tryReadFromChannel() just publishes the data that was already buffered by the pipe reader. Reading from the pipe was still possible only because the pipe writer enters an alertable wait state which can trigger an I/O callback for the read operation as well. This made the implementation unclear and tied to APC behavior. To avoid this, we now call the "proper" pipe reader wait function instead, which also unifies the code with the other waitFor...() implementations. Change-Id: I7376d7973477a722472ff8763f95f39e6ea2fce9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Fix some MSVC conversion warningsFriedemann Kleint2020-09-221-2/+2
| | | | | Change-Id: Ib2c1fdb7b84f89201136438362ab5962126ec929 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* QProcess/Win: Fix build in debug modeAlex Trotsenko2020-06-051-1/+2
| | | | | | | | | | Suppress a compile warning: io\qprocess_win.cpp: 623:101: error: format '%d' expects argument of ... Pick-to: 5.15 Change-Id: I9ea94ddfc21afea5d1a78e264507a36435cce063 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Avoid using a QRegExp for trivial replacementsLars Knoll2019-12-131-2/+11
| | | | | | | | | | | It's slow and we want to get rid of it. In this case, it's just as easy to do the replacing manually using a small loop. Task-number: QTBUG-72587 Change-Id: I32e1cc89642bc0e5b6f500d072960cd8871e0684 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Make QObjectPrivate::threadData a proper atomicGiuseppe D'Angelo2019-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QObjectPrivate::threadData used to be a QThreadData *, and was read and written from multiple threads without proper synchronization. As an example, it was read from QCoreApplication::postEvent and written from QObject::moveToThread, therefore causing UB. Port threadData to a proper atomic, removing the races. Fix all usage points. In general, QObject is documented to be simply reentrant, not thread-safe, and certain bits (e.g. timers, moveToThread) are not even reentrant. The reasoning therefore is that a given QObject's threadData is not supposed to be touched by multiple threads without some synchronization happening elsewhere, and therefore relaxed loads should be sufficient. As drive-by change: refactor QCoreApplication::postEvent. It was particularly subtle, because it had a loop using a volatile to cope with the possibility of the receiver object switching thread while we tried to lock its thread's event queue. However, volatile does not achieve any synchronization, so drop it, and refactor the algorithm using better locking primitives. Put this algorithm in a common place, and also reuse it from removePostedEvents, which was lacking any synchronization. Change-Id: Icc755f7eb418ff54b33db4bdd87fd8eaf4e82c7a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcess: Fix crash when calling closeWriteChannel on WindowsJoerg Bornemann2019-02-211-8/+14
| | | | | | | | | | | | | We must deleteLater the pipe writer in closeChannel, because if you call closeWriteChannel() from a slot that is connected to a signal emitted from QWindowsPipeWriter, we'd operate on a deleted object. For consistency, we're calling QWindowsPipeWriter::stop before deleteLater and deduplicate the code. Fixes: QTBUG-73778 Change-Id: I61d3dedf57e9fd02517a108d13ffc85e006330f6 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Windows code: Fix clang-tidy warnings about else after jumpsFriedemann Kleint2018-09-021-51/+51
| | | | | | | | | Replace by switch() where appropriate, remove else and unindent code or simplify the return value. Change-Id: Ie988b9068a9579ae5a899b3765e43aad480b564e Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-08-071-5/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/doc/src/objectmodel/signalsandslots.qdoc src/plugins/platforms/cocoa/qcocoamenuloader.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp tests/auto/gui/image/qimage/tst_qimage.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I9bd24ee9b00d4f26c8f344ce3970aa6e93935ff5
| * QProcess::startDetached: Fix behavior change on WindowsJoerg Bornemann2018-08-031-5/+9
| | | | | | | | | | | | | | | | | | Do not overwrite stdout/stderr by default, but only if requested. This restores the behavior of QProcess::startDetached of Qt 5.9. Task-number: QTBUG-67905 Change-Id: Idccf7b0da7bd80f88a0624286ddf2851bc974fb1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | QProcess/Win: Use ConnectNamedPipe asynchronously and check return valueJoerg Bornemann2018-05-261-1/+20
|/ | | | | | | | | | | | | | | | According to the documentation of ConnectNamedPipe we must pass an OVERLAPPED object, because the passed handle was opened with FILE_FLAG_OVERLAPPED. Pass an OVERLAPPED object, and create a manual reset event that is waited on if ConnectNamedPipe "fails" with ERROR_IO_PENDING. Check the return type, and report any failure via qErrnoWarning. Change-Id: Iedd702cecc2f0008eee6ed4f19d9370912190595 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QProcess: set proper error state if we failed to create a pipeThiago Macieira2018-05-021-1/+6
| | | | | | | | | | | | | | | If the pipe creation fails, we need to properly close the pipes that were successfully created, emit the signal indicating failure and set the state back to NotRunning. The error string is reused from below, so there's no new translatable string. Task-number: QTBUG-67744 Change-Id: If90a92b041d3442fa0a4fffd1526207698f234a6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-141-1/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/animation/qvariantanimation.cpp src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/corelib/io/qprocess_win.cpp src/corelib/json/qjsonarray.cpp src/corelib/tools/qsimd_p.h src/corelib/tools/qtimezoneprivate_p.h src/corelib/xml/qxmlstream_p.h src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qsimpledrag_p.h src/plugins/generic/generic.pro src/plugins/platforms/cocoa/qcocoamenu.mm src/widgets/styles/qmacstyle_mac.mm tests/auto/concurrent/qtconcurrentmap/BLACKLIST tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qmessagebox/BLACKLIST Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
| * QProcess/Windows: Include PID in pipe namesFrank Richter2018-01-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although qt_create_pipe() tries again if the pipe name is already in use, it doesn't handle the case when another user has created the pipe with the name (the error is "access denied" in that case). The chance that it happens is small, but it can be entirely eliminated by including a unique part in the pipe name, in this case the PID. [ChangeLog][Windows] Named pipes internally created by QProcess now contain the PID in their name to ensure uniqueness. Change-Id: I079f1b68695c1ddea3eccad241061d11e08b60f4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-231-4/+3
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttp2protocolhandler_p.h src/network/kernel/kernel.pri src/network/ssl/qsslkey_qt.cpp src/plugins/platforms/cocoa/qcocoascreen.mm src/plugins/platforms/windows/accessible/iaccessible2.cpp src/plugins/platforms/windows/accessible/iaccessible2.h src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h src/widgets/widgets/qmenu_p.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/other/qaccessibility/tst_qaccessibility.cpp tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
| * | Change almost all other uses of qrand() to QRandomGeneratorThiago Macieira2017-11-081-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vast majority is actually switched to QRandomGenerator::bounded(), which gives a mostly uniform distribution over the [0, bound) range. There are very few floating point cases left, as many of those that did use floating point did not need to, after all. (I did leave some that were too ugly for me to understand) This commit also found a couple of calls to rand() instead of qrand(). This commit does not include changes to SSL code that continues to use qrand() (job for someone else): src/network/ssl/qsslkey_qt.cpp src/network/ssl/qsslsocket_mac.cpp tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Qt Core: Remove code for Windows < 7Friedemann Kleint2017-10-051-3/+1
|/ / | | | | | | | | | | Change-Id: I919827c6016156af596fd90fc5563445e0ae4228 Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-191-7/+7
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/corelib/io/qprocess_win.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/windows/qwindowscontext.cpp src/plugins/platforms/windows/windows.pri src/tools/uic/cpp/cppwriteinitialization.cpp src/widgets/doc/src/widgets-and-layouts/gallery.qdoc Change-Id: I8d0834c77f350ea7540140c2c7f372814afc2d0f