diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-22 01:00:26 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-22 01:00:27 +0100 |
commit | 64085d9b2f5ca45139ce582e212e0a416b9215fb (patch) | |
tree | e1f08f620753fc12ab66a09ab83229796bbe6e52 /src/corelib/io | |
parent | b5c16921cca0d5ae966a36cb451ec0b322b967ed (diff) | |
parent | 1136c9849e26423f72d7a0a7a92be8c93c13d7a6 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I9e7cb1b131b7b216aad8ed1b1536669fd1557c21
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qprocess_win.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index cb4b2f9f91..3ba86063e3 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -362,16 +362,22 @@ void QProcessPrivate::destroyPipe(Q_PIPE pipe[2]) } } +template <class T> +void deleteWorker(T *&worker) +{ + if (!worker) + return; + worker->stop(); + worker->deleteLater(); + worker = nullptr; +} + void QProcessPrivate::closeChannel(Channel *channel) { - if (channel == &stdinChannel) { - delete stdinChannel.writer; - stdinChannel.writer = 0; - } else if (channel->reader) { - channel->reader->stop(); - channel->reader->deleteLater(); - channel->reader = 0; - } + if (channel == &stdinChannel) + deleteWorker(channel->writer); + else + deleteWorker(channel->reader); destroyPipe(channel->pipe); } |