From 213c7e96c769cd7623aed57e3ed972ff3a160f29 Mon Sep 17 00:00:00 2001 From: vng Date: Fri, 2 Mar 2012 03:40:28 +0300 Subject: [PATCH] Correct order of scope gurds (and dctor calls). --- coding/zip_reader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coding/zip_reader.cpp b/coding/zip_reader.cpp index 806e4d4b37..37765e4463 100644 --- a/coding/zip_reader.cpp +++ b/coding/zip_reader.cpp @@ -95,8 +95,10 @@ void ZipFileReader::UnzipFile(string const & zipContainer, string const & fileIn static size_t const BUF_SIZE = 1024 * 50; vector buf(BUF_SIZE); - FileWriter outFile(outFilePath); + // First outFile should be closed, then FileWriter::DeleteFileX is called, + // so make correct order of guards. MY_SCOPE_GUARD(outFileGuard, bind(&FileWriter::DeleteFileX, cref(outFilePath))); + FileWriter outFile(outFilePath); int pos = 0; while (true)