From fc2f3983bc40184a855401871ab894c903a3f212 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 23 May 2022 10:16:39 +0200 Subject: [PATCH] QtcProcess: Don't merge ready read signals We store pointers to signal objects inside m_signals list, so we can't easily merge the old ready read signal with the new one, since when flushing the m_signals from the main thread we are taking copy of m_signals, but this copy still holds the pointers to the original objects, and using them outside of locked mutex isn't safe. The possible solution would be to store simple data structures instead of signal objects allocated on heap. However, there is not really much gain of merging the ready read signals, so we get rid of it. Task-number: QTCREATORBUG-27578 Change-Id: Idd19a6fc1ebb4ccab1e4e367cfeb3f2f02a35512 Reviewed-by: Reviewed-by: hjk Reviewed-by: Eike Ziller --- src/libs/utils/launchersocket.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/libs/utils/launchersocket.cpp b/src/libs/utils/launchersocket.cpp index c232579e20d..d2ee1cf19fd 100644 --- a/src/libs/utils/launchersocket.cpp +++ b/src/libs/utils/launchersocket.cpp @@ -83,10 +83,6 @@ public: , m_stdErr(stdErr) {} QByteArray stdOut() const { return m_stdOut; } QByteArray stdErr() const { return m_stdErr; } - void mergeWith(ReadyReadSignal *newSignal) { - m_stdOut += newSignal->stdOut(); - m_stdErr += newSignal->stdErr(); - } private: QByteArray m_stdOut; QByteArray m_stdErr; @@ -268,16 +264,6 @@ void CallerHandle::appendSignal(LauncherSignal *launcherSignal) QMutexLocker locker(&m_mutex); QTC_ASSERT(isCalledFromLaunchersThread(), return); - // Merge ReadyRead signals into one. - if (launcherSignal->signalType() == CallerHandle::SignalType::ReadyRead - && !m_signals.isEmpty() - && m_signals.last()->signalType() == CallerHandle::SignalType::ReadyRead) { - ReadyReadSignal *lastSignal = static_cast(m_signals.last()); - ReadyReadSignal *newSignal = static_cast(launcherSignal); - lastSignal->mergeWith(newSignal); - delete newSignal; - return; - } m_signals.append(launcherSignal); }