| 13 | SavePos=Src.Tell(); |
| 14 | } |
| 15 | ~SaveFilePos() |
| 16 | { |
| 17 | // Unless the file is already closed either by current exception |
| 18 | // processing or intentionally by external code. |
| 19 | if (SaveFile->IsOpened()) |
| 20 | { |
| 21 | try |
| 22 | { |
| 23 | SaveFile->Seek(SavePos,SEEK_SET); |
| 24 | } |
| 25 | catch(RAR_EXIT) |
| 26 | { |
| 27 | // Seek() can throw an exception and it terminates process |
| 28 | // if we are already processing another exception. Also in C++ 11 |
| 29 | // an exception in destructor always terminates process unless |
| 30 | // we mark destructor with noexcept(false). So we do not want to |
| 31 | // throw here. To prevent data loss we do not want to continue |
| 32 | // execution after seek error, so we close the file. |
| 33 | // Any next access to this file will return an error. |
| 34 | SaveFile->Close(); |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | }; |
| 39 | |
| 40 | #endif |