forked from qt-creator/qt-creator
CtfVisualizer: Never crash with uncaught exception when loading JSON
If we retrieve a value of a type that doesn't match the actual type in the JSON, the JSON library throws an exception. We should have checks to avoid this, but as a global measure never let exceptions through to Qt Creator. Change-Id: Ibfe830d745a94810f874ccca82b83d57ea72f31e Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -162,8 +162,11 @@ void CtfVisualizerTool::loadJson()
|
||||
auto *task = new QFuture<void>(futureInterface);
|
||||
|
||||
QThread *thread = QThread::create([this, filename, futureInterface]() {
|
||||
m_traceManager->load(filename);
|
||||
|
||||
try {
|
||||
m_traceManager->load(filename);
|
||||
} catch (...) {
|
||||
// nlohmann::json can throw exceptions when requesting type that is wrong
|
||||
}
|
||||
m_modelAggregator->moveToThread(QApplication::instance()->thread());
|
||||
m_modelAggregator->setParent(this);
|
||||
futureInterface->reportFinished();
|
||||
|
Reference in New Issue
Block a user