Skip to content

Commit 759bd72

Browse files
committed
core/log: stop trying to store detailed logs after write fail
Not stopping will cause the logger's write buffer to fill until OOM if writing fails.
1 parent 63a6d27 commit 759bd72

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/core/logging.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -457,10 +457,14 @@ void ThreadLogging::onMessage(const LogMessage& msg, bool showInSparse) {
457457
this->fileStream << Qt::endl;
458458
}
459459

460-
if (this->detailedWriter.write(msg)) {
461-
this->detailedFile->flush();
462-
} else if (this->detailedFile != nullptr) {
463-
qCCritical(logLogging) << "Detailed logger failed to write. Ending detailed logs.";
460+
if (!this->detailedWriter.write(msg) || (this->detailedFile && !this->detailedFile->flush())) {
461+
if (this->detailedFile) {
462+
qCCritical(logLogging) << "Detailed logger failed to write. Ending detailed logs.";
463+
}
464+
465+
this->detailedWriter.setDevice(nullptr);
466+
this->detailedFile->close();
467+
this->detailedFile = nullptr;
464468
}
465469
}
466470

0 commit comments

Comments
 (0)