forked from qt-creator/qt-creator
QtcProcess: Fix crash when logging process stats
Change-Id: I204366a008dea91d1b2b946689c7598fe9ab009c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -711,7 +711,11 @@ QtcProcess::QtcProcess(QObject *parent)
|
|||||||
|
|
||||||
if (processLog().isDebugEnabled()) {
|
if (processLog().isDebugEnabled()) {
|
||||||
connect(this, &QtcProcess::finished, [this] {
|
connect(this, &QtcProcess::finished, [this] {
|
||||||
if (const QVariant n = d->m_process.get()->property(QTC_PROCESS_NUMBER); n.isValid()) {
|
if (!d->m_process.get())
|
||||||
|
return;
|
||||||
|
const QVariant n = d->m_process.get()->property(QTC_PROCESS_NUMBER);
|
||||||
|
if (!n.isValid())
|
||||||
|
return;
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
const quint64 msSinceEpoc =
|
const quint64 msSinceEpoc =
|
||||||
duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
|
duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count();
|
||||||
@@ -732,7 +736,6 @@ QtcProcess::QtcProcess(QObject *parent)
|
|||||||
if (processStderrLog().isDebugEnabled() && !stdErr().isEmpty())
|
if (processStderrLog().isDebugEnabled() && !stdErr().isEmpty())
|
||||||
qCDebug(processStderrLog).nospace()
|
qCDebug(processStderrLog).nospace()
|
||||||
<< "Process " << number << " stderr: " << stdErr();
|
<< "Process " << number << " stderr: " << stdErr();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user