aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2024-01-09 12:57:44 +0100
committerDavid Schulz <david.schulz@qt.io>2024-01-10 10:54:16 +0000
commit9bcaf9ced9190e9f6db09daa936d449fa7ee39ac (patch)
treea6e1cdf67826f9b6f127439ff0002208b0ca3d4c
parenta6dea9091f1a729a742c82e829ff8ddfd230257e (diff)
ProjectExplorer: do not concatenate win debug messages
Individual debug messages got concatenated without a newline character if multiple messages were received by the windebug interface thread before they were handled in the main thread. The receiver of those messages had no chance of handling those messages individually. This gets fixed by using a list of messages instead of one concatenated string. Change-Id: Icfaf1b22db56829fcd143e574ee1033a63226c29 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r--src/plugins/projectexplorer/runcontrol.cpp14
-rw-r--r--src/plugins/projectexplorer/windebuginterface.cpp23
-rw-r--r--src/plugins/projectexplorer/windebuginterface.h2
3 files changed, 22 insertions, 17 deletions
diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp
index 5de202b946..94093fe150 100644
--- a/src/plugins/projectexplorer/runcontrol.cpp
+++ b/src/plugins/projectexplorer/runcontrol.cpp
@@ -1272,11 +1272,15 @@ SimpleTargetRunnerPrivate::SimpleTargetRunnerPrivate(SimpleTargetRunner *parent)
+ QLatin1Char('\n'), ErrorMessageFormat);
});
- connect(WinDebugInterface::instance(), &WinDebugInterface::debugOutput,
- this, [this](qint64 pid, const QString &message) {
- if (privateApplicationPID() == pid)
- q->appendMessage(message, DebugFormat);
- });
+ connect(WinDebugInterface::instance(),
+ &WinDebugInterface::debugOutput,
+ this,
+ [this](qint64 pid, const QList<QString> &messages) {
+ if (privateApplicationPID() != pid)
+ return;
+ for (const QString &message : messages)
+ q->appendMessage(message, DebugFormat);
+ });
}
}
diff --git a/src/plugins/projectexplorer/windebuginterface.cpp b/src/plugins/projectexplorer/windebuginterface.cpp
index 25f525e9ef..75285669a4 100644
--- a/src/plugins/projectexplorer/windebuginterface.cpp
+++ b/src/plugins/projectexplorer/windebuginterface.cpp
@@ -150,22 +150,23 @@ void WinDebugInterface::dispatchDebugOutput()
QTC_ASSERT(Utils::isMainThread(), return);
static size_t maxMessagesToSend = 100;
- std::vector<std::pair<qint64, QString>> output;
+ std::map<qint64, QList<QString>> output;
bool hasMoreOutput = false;
m_outputMutex.lock();
for (auto &entry : m_debugOutput) {
- std::vector<QString> &src = entry.second;
- if (src.empty())
- continue;
- QString dst;
- size_t n = std::min(maxMessagesToSend, src.size());
- for (size_t i = 0; i < n; ++i)
- dst += src.at(i);
- src.erase(src.begin(), std::next(src.begin(), n));
- if (!src.empty())
+ auto it = entry.second.begin();
+ for (; it != entry.second.end(); ++it) {
+ output[entry.first].push_back(*it);
+ if (output.size() >= maxMessagesToSend)
+ break;
+ }
+ if (it != entry.second.begin())
+ it = entry.second.erase(entry.second.begin(), it);
+ if (it != entry.second.end()) {
hasMoreOutput = true;
- output.emplace_back(entry.first, std::move(dst));
+ break;
+ }
}
if (!hasMoreOutput)
m_readySignalEmitted = false;
diff --git a/src/plugins/projectexplorer/windebuginterface.h b/src/plugins/projectexplorer/windebuginterface.h
index a9d78fc111..e759e2252c 100644
--- a/src/plugins/projectexplorer/windebuginterface.h
+++ b/src/plugins/projectexplorer/windebuginterface.h
@@ -27,7 +27,7 @@ public:
static void startIfNeeded();
signals:
- void debugOutput(qint64 pid, const QString &message);
+ void debugOutput(qint64 pid, const QList<QString> &messages);
void cannotRetrieveDebugOutput();
void _q_debugOutputReady();