From: Georg Baum Date: Sun, 20 Sep 2015 17:43:06 +0000 (+0200) Subject: Forbid wrong compiler generated copy constructors X-Git-Tag: 2.2.0alpha1~304 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1ad4d9e657994f8d723ed4089f7dfeb1b9466edb;p=lyx.git Forbid wrong compiler generated copy constructors This fixes cppcheck warnings (style) 'class x' does not have a copy constructor which is recommended since the class contains a pointer to allocated memory. --- diff --git a/src/Thesaurus.h b/src/Thesaurus.h index e27f2c239a..52987cdd13 100644 --- a/src/Thesaurus.h +++ b/src/Thesaurus.h @@ -27,6 +27,9 @@ namespace lyx { class Thesaurus { + /// noncopyable + Thesaurus(Thesaurus const &); + void operator=(Thesaurus const &); public: /// Thesaurus(); diff --git a/src/Undo.h b/src/Undo.h index 1bd6450d7c..bacce0307e 100644 --- a/src/Undo.h +++ b/src/Undo.h @@ -47,6 +47,9 @@ enum UndoKind { class Undo { + /// noncopyable + Undo(Undo const &); + void operator=(Undo const &); public: Undo(Buffer &); diff --git a/src/frontends/qt4/FileDialog.h b/src/frontends/qt4/FileDialog.h index 99a98369dc..fe75b5bf1e 100644 --- a/src/frontends/qt4/FileDialog.h +++ b/src/frontends/qt4/FileDialog.h @@ -25,6 +25,9 @@ namespace lyx { */ class FileDialog { + /// noncopyable + FileDialog(FileDialog const &); + void operator=(FileDialog const &); public: /// label, directory path button typedef std::pair Button; diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index ed7835fcca..b3a697cb86 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -269,8 +269,12 @@ typedef shared_ptr DialogPtr; } // namespace anon -struct GuiView::GuiViewPrivate +class GuiView::GuiViewPrivate { + /// noncopyable + GuiViewPrivate(GuiViewPrivate const &); + void operator=(GuiViewPrivate const &); +public: GuiViewPrivate(GuiView * gv) : gv_(gv), current_work_area_(0), current_main_work_area_(0), layout_(0), autosave_timeout_(5000), diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 74aad81f83..c3ccdbd80a 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -287,7 +287,7 @@ private: bool goToFileRow(std::string const & argument); /// - struct GuiViewPrivate; + class GuiViewPrivate; GuiViewPrivate & d; public: diff --git a/src/frontends/qt4/LayoutBox.cpp b/src/frontends/qt4/LayoutBox.cpp index 0a4da44937..1054a09812 100644 --- a/src/frontends/qt4/LayoutBox.cpp +++ b/src/frontends/qt4/LayoutBox.cpp @@ -103,8 +103,12 @@ public: // ///////////////////////////////////////////////////////////////////// -struct LayoutBox::Private +class LayoutBox::Private { + /// noncopyable + Private(Private const &); + void operator=(Private const &); +public: Private(LayoutBox * parent, GuiView & gv) : p(parent), owner_(gv), inset_(0), // set the layout model with two columns diff --git a/src/frontends/qt4/LayoutBox.h b/src/frontends/qt4/LayoutBox.h index 0b37e7e82a..3ea92325f1 100644 --- a/src/frontends/qt4/LayoutBox.h +++ b/src/frontends/qt4/LayoutBox.h @@ -61,7 +61,7 @@ private Q_SLOTS: private: friend class LayoutItemDelegate; - struct Private; + class Private; Private * const d; }; diff --git a/src/frontends/qt4/Menus.h b/src/frontends/qt4/Menus.h index 0ee073e9fb..9bc78e3480 100644 --- a/src/frontends/qt4/Menus.h +++ b/src/frontends/qt4/Menus.h @@ -58,6 +58,9 @@ private: class Menus { + /// noncopyable + Menus(Menus const &); + void operator=(Menus const &); public: Menus(); ~Menus(); diff --git a/src/frontends/qt4/TocModel.h b/src/frontends/qt4/TocModel.h index 6b4315b36b..4d4d442719 100644 --- a/src/frontends/qt4/TocModel.h +++ b/src/frontends/qt4/TocModel.h @@ -34,6 +34,9 @@ class TocTypeModel; /// There is one TocModel per list in the TocBackend. class TocModel { + /// noncopyable + TocModel(TocModel const &); + void operator=(TocModel const &); public: /// TocModel(QObject * parent);