summaryrefslogtreecommitdiff
path: root/cpp/poppler-image.cpp
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2018-01-08 18:07:38 +0100
committerAlbert Astals Cid <aacid@kde.org>2018-01-08 18:37:33 +0100
commit8794789a72f845b009656e6d7ae6a00b709e09bc (patch)
tree82220f5640d4abcf726f6e83e59cd6bb59cc4d67 /cpp/poppler-image.cpp
parent4c7814342806b61fedbb2d45ce74462f9dbc20bc (diff)
Delete lots of copy constructors and copy assignment operators
Fixes rule-of-three and copyable-polymorphic warnings reported by clazy. The default copy constructor and copy assignment operator are only valid for simple classes so we delete them (i.e. make then not exist) when we have either a virtual class or a destructor, the code still compiles so this doesn't fix any bug, it is more a protection for when you think you can copy a class and don't realize the default copy constrcutor is not doing what you want and you get crashes. Hopefully this helps us in the future :)
Diffstat (limited to 'cpp/poppler-image.cpp')
-rw-r--r--cpp/poppler-image.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/cpp/poppler-image.cpp b/cpp/poppler-image.cpp
index de699e82..aab2bb48 100644
--- a/cpp/poppler-image.cpp
+++ b/cpp/poppler-image.cpp
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2010-2011, Pino Toscano <pino@kde.org>
* Copyright (C) 2013 Adrian Johnson <ajohnson@redneon.com>
- * Copyright (C) 2017, Albert Astals Cid <aacid@kde.org>
+ * Copyright (C) 2017, 2018, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2017, Jeroen Ooms <jeroenooms@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -49,6 +49,8 @@ struct FileCloser {
: f(ff) {}
inline ~FileCloser()
{ (void)close(); }
+ FileCloser(const FileCloser &) = delete;
+ FileCloser& operator=(const FileCloser &) = delete;
inline bool close()
{ if (f) { const int c = fclose(f); f = 0; return c == 0; } return true; }