From c8a5b4a618ebf7dd05c69d150ede03db3ab5d2b8 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 4 Mar 2019 15:00:59 +0200 Subject: [PATCH] Collect garbage only in gui mode. --HG-- branch : develop --- src/app/valentina/mainwindow.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index e5469dde1..df76f1e83 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -4719,13 +4719,16 @@ bool MainWindow::LoadPattern(QString fileName, const QString& customMeasureFile) if (guiEnabled) { // No errors occurred - /* Collect garbage only after successfully parse. This way wrongly accused items have one more time to restore - * a reference. */ + if (qApp->IsGUIMode()) + { + /* Collect garbage only after successfully parse. This way wrongly accused items have one more time to restore + * a reference. */ #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) - QTimer::singleShot(100, Qt::CoarseTimer, this, [this](){doc->GarbageCollector(true);}); + QTimer::singleShot(100, Qt::CoarseTimer, this, [this](){doc->GarbageCollector(true);}); #else - doc->GarbageCollector(true); + doc->GarbageCollector(true); #endif + } patternReadOnly = doc->IsReadOnly(); SetEnableWidgets(true);