From 576b91dd3159dfd2033df015bae7e9e60fc29623 Mon Sep 17 00:00:00 2001 From: Anton Filimonov Date: Thu, 24 Dec 2020 13:07:18 +0300 Subject: [PATCH] Fix file saving (#234) --- src/ui/src/abstractlogview.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ui/src/abstractlogview.cpp b/src/ui/src/abstractlogview.cpp index 2df7f64e3..e69c105f6 100644 --- a/src/ui/src/abstractlogview.cpp +++ b/src/ui/src/abstractlogview.cpp @@ -1086,8 +1086,8 @@ void AbstractLogView::saveToFile() using LinesData = std::pair, bool>; auto lineReader = tbb::flow::source_node( saveFileGraph, - [ this, &offsets, &interruptRequest, &progressDialog, - offsetIndex = 0u ]( LinesData& lines ) mutable -> bool { + [ this, &offsets, &interruptRequest, &progressDialog, offsetIndex = 0u, + finalLines = false ]( LinesData& lines ) mutable -> bool { if ( !interruptRequest && offsetIndex < offsets.size() ) { const auto& offset = offsets.at( offsetIndex ); lines.first = logData->getLines( offset.first, offset.second ); @@ -1103,9 +1103,12 @@ void AbstractLogView::saveToFile() progressDialog.setValue( static_cast( offsetIndex ) ); return true; } - else { + else if ( !finalLines ) { + finalLines = true; lines.second = false; - + return true; + } + else { return false; } },