diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2014-09-25 19:25:47 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2014-09-26 13:27:40 -0400 |
commit | 6eb67b0ed2b350b772f7edb67aee1bcf09c91b0b (patch) | |
tree | f0e5a6c11a01cbfc861ed86fcd122ff7253a5948 /src | |
parent | eee030f6bc62117b4d3c27aa78818964d95a7063 (diff) |
autofile: Disallow by-value copies of CAutoFile
One might assume that CAutoFile would be ref-counted so that a copied object
would delay closing the underlying file until all copies have gone out of
scope. Since that's not the case with CAutoFile, explicitly disable copying.
Diffstat (limited to 'src')
-rw-r--r-- | src/serialize.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/serialize.h b/src/serialize.h index 447d808dee..7f8f933284 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1154,7 +1154,7 @@ public: -/** RAII wrapper for FILE*. +/** Non-refcounted RAII wrapper for FILE*. * * Will automatically close the file when it goes out of scope if not null. * If you're returning the file pointer, return file.release(). @@ -1162,6 +1162,10 @@ public: */ class CAutoFile { +private: + // Disallow copies + CAutoFile(const CAutoFile&); + CAutoFile& operator=(const CAutoFile&); protected: FILE* file; public: |