forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -1272,9 +1272,13 @@ SimpleTargetRunnerPrivate::SimpleTargetRunnerPrivate(SimpleTargetRunner *parent)
|
||||
+ QLatin1Char('\n'), ErrorMessageFormat);
|
||||
});
|
||||
|
||||
connect(WinDebugInterface::instance(), &WinDebugInterface::debugOutput,
|
||||
this, [this](qint64 pid, const QString &message) {
|
||||
if (privateApplicationPID() == pid)
|
||||
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);
|
||||
});
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user