--- a/src/documentmanager.cpp Sun Jul 03 22:32:50 2022 +0300 +++ b/src/documentmanager.cpp Sun Jul 03 23:54:22 2022 +0300 @@ -121,7 +121,7 @@ file.open(QFile::ReadOnly | QFile::Text); std::unique_ptr<Model> newModel = std::make_unique<Model>(nullptr); QTextStream textStream{&file}; - Parser parser{file}; + Parser parser{textStream}; parser.parseBody(*newModel); std::optional<ModelId> result; if (file.error() == QFile::NoError) @@ -195,7 +195,8 @@ QSaveFile file{info->path}; file.setDirectWriteFallback(true); if (file.open(QSaveFile::WriteOnly)) { - ::save(*info->model.get(), &file); + QTextStream stream{&file}; + ::save(*info->model.get(), &stream); const bool commitSucceeded = file.commit(); if (not commitSucceeded) { errors << QObject::tr("Could not save: %1").arg(file.errorString());