]> git.lyx.org Git - features.git/commitdiff
Don't double delete by making TempFile noncopyable
authorGeorg Baum <baum@lyx.org>
Mon, 9 Jun 2014 10:59:47 +0000 (12:59 +0200)
committerGeorg Baum <baum@lyx.org>
Mon, 9 Jun 2014 11:03:32 +0000 (13:03 +0200)
The compiler generated copy constructor and assignment operator are wrong.
This could easily be fixed by implementing them manually, but a) they are
not needed, and b) the semantics would be unclear (should the copy point
to a new temp file or not?), so it is better to forbid them.

src/support/TempFile.h

index 6410dda7fcee4e1e99195a51474575a444fab58f..b99ee756a16c9d67541a2c2b4ab16399e6a025f9 100644 (file)
@@ -26,6 +26,10 @@ class FileName;
  * of this class must stay alive as long as the file is needed.
  */
 class TempFile {
+       /// noncopyable
+       TempFile(TempFile const &);
+       /// nonassignable
+       TempFile & operator=(TempFile const &);
 public:
        /**
         *Create a temporary file with the given mask.