Merge pull request #564 from DieterMayerOSS/pr/restore-qt6-autosave

Restore crash-recovery autosave on Qt6
This commit is contained in:
Laurent Trinques
2026-07-28 17:37:07 +02:00
committed by GitHub
+6 -10
View File
@@ -1914,21 +1914,17 @@ void QETProject::writeBackup()
{
if (!m_backup_enabled)
return;
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
//Don't launch a new backup while the previous one is still writing:
//both would write through &m_backup_file on different threads.
if (m_backup_future.isRunning())
return;
//Capture the document by value (implicitly shared, so cheap): the
//Qt5-style QtConcurrent::run(function, reference-args) call did not
//survive the Qt6 API change, a lambda behaves identically on both.
QDomDocument xml_project(toXml());
m_backup_future = QtConcurrent::run(
QET::writeToFile,xml_project,&m_backup_file,nullptr);
# else
# if TODO_LIST
# pragma message("@TODO remove code for QT 6 or later")
# endif
qDebug() << "Help code for QT 6 or later"
<< "QtConcurrent::run its backwards now...function, object, args";
# endif
m_backup_future = QtConcurrent::run([this, xml_project]() mutable {
return QET::writeToFile(xml_project, &m_backup_file, nullptr);
});
}
/**