From a29cb45f6a95865aabb8d4f0bab746cc17d15eca Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Wed, 25 Sep 2019 16:12:10 +0000 Subject: [PATCH] added: in FileLog::save_log(): test whether synchro_lock() has returned true git-svn-id: svn://ttmath.org/publicrep/pikotools/trunk@1216 e52654a7-88a9-db11-a3e9-0013d4bc506e --- log/filelog.cpp | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/log/filelog.cpp b/log/filelog.cpp index 097bbd4..e4de22e 100644 --- a/log/filelog.cpp +++ b/log/filelog.cpp @@ -105,34 +105,35 @@ void FileLog::save_log(PT::WTextStream * buffer) if( buffer->empty() ) return; - synchro_lock(); - - try + if( synchro_lock() ) { - if( log_stdout ) + try { - PT::WideToUTF8(*buffer, std::cout); - } - - if( !log_file.empty() ) - { - if( !log_file_open || !file ) + if( log_stdout ) { - file.close(); - file.clear(); - - open_file(); + PT::WideToUTF8(*buffer, std::cout); } - if( file ) + if( !log_file.empty() ) { - PT::WideToUTF8(*buffer, file); - file.flush(); + if( !log_file_open || !file ) + { + file.close(); + file.clear(); + + open_file(); + } + + if( file ) + { + PT::WideToUTF8(*buffer, file); + file.flush(); + } } } - } - catch(...) - { + catch(...) + { + } } synchro_unlock();