summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_win.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2021-06-15 19:51:36 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2021-06-18 17:25:43 +0300
commita73ec95c1e5aea907ac4618122f4715924c883e6 (patch)
tree7b9910d7a0bf0e6644251f5cb48dec7a70f0d0ac /src/corelib/io/qprocess_win.cpp
parente6a969954a9e6865e5f662acd1d949561f8ef3be (diff)
Allow destruction of QWindowsPipeReader in its signal
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>
Diffstat (limited to 'src/corelib/io/qprocess_win.cpp')
-rw-r--r--src/corelib/io/qprocess_win.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 65422659b0..e557d10453 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -359,22 +359,15 @@ 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)
- deleteWorker(channel->writer);
- else
- deleteWorker(channel->reader);
+ if (channel == &stdinChannel) {
+ delete channel->writer;
+ channel->writer = nullptr;
+ } else {
+ delete channel->reader;
+ channel->reader = nullptr;
+ }
destroyPipe(channel->pipe);
}