From 1becd75946b6cc36735bc51c0a7f8603c075c7ce Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Fri, 29 Feb 2008 20:16:04 +0000 Subject: [PATCH] These don't seem to be causing crashes at the moment, but as a matter of long-term stability, it seems worth cloning them the "canonical" way. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23360 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetLine.h | 2 +- src/insets/InsetNewline.h | 7 ++----- src/insets/InsetSpace.cpp | 5 ----- src/insets/InsetSpace.h | 2 +- src/insets/InsetSpecialChar.cpp | 6 ------ src/insets/InsetSpecialChar.h | 2 +- 6 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/insets/InsetLine.h b/src/insets/InsetLine.h index 5262a54670..c8af93291b 100644 --- a/src/insets/InsetLine.h +++ b/src/insets/InsetLine.h @@ -45,7 +45,7 @@ public: /// void validate(LaTeXFeatures & features) const; private: - Inset * clone() const { return new InsetLine; } + Inset * clone() const { return new InsetLine(*this); } }; diff --git a/src/insets/InsetNewline.h b/src/insets/InsetNewline.h index 0ffbb64331..48147f6503 100644 --- a/src/insets/InsetNewline.h +++ b/src/insets/InsetNewline.h @@ -54,7 +54,7 @@ public: virtual ColorCode ColorName() const { return Color_eolmarker; } private: - Inset * clone() const { return new InsetNewline; } + Inset * clone() const { return new InsetNewline(*this); } }; class InsetLinebreak : public InsetNewline { @@ -70,10 +70,7 @@ public: ColorCode ColorName() const { return Color_pagebreak; } private: - virtual Inset * clone() const - { - return new InsetLinebreak; - } + virtual Inset * clone() const { return new InsetLinebreak(*this); } }; diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index 8e7e404060..79d32b10e4 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -228,9 +228,4 @@ void InsetSpace::textString(odocstream & os) const } -Inset * InsetSpace::clone() const -{ - return new InsetSpace(kind_); -} - } // namespace lyx diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h index 9298ed10cc..c9ac045c23 100644 --- a/src/insets/InsetSpace.h +++ b/src/insets/InsetSpace.h @@ -84,7 +84,7 @@ public: // a line separator)? bool isSpace() const { return true; } private: - virtual Inset * clone() const; + virtual Inset * clone() const { return new InsetSpace(*this); } /// And which kind is this? Kind kind_; diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp index 99707cbb59..e25cda9454 100644 --- a/src/insets/InsetSpecialChar.cpp +++ b/src/insets/InsetSpecialChar.cpp @@ -291,12 +291,6 @@ void InsetSpecialChar::textString(odocstream & os) const } -Inset * InsetSpecialChar::clone() const -{ - return new InsetSpecialChar(kind_); -} - - void InsetSpecialChar::validate(LaTeXFeatures & features) const { if (kind_ == MENU_SEPARATOR) diff --git a/src/insets/InsetSpecialChar.h b/src/insets/InsetSpecialChar.h index 7172cf5424..d2e18d7c35 100644 --- a/src/insets/InsetSpecialChar.h +++ b/src/insets/InsetSpecialChar.h @@ -80,7 +80,7 @@ public: // should we break lines after this inset? bool isLineSeparator() const; private: - Inset * clone() const; + Inset * clone() const { return new InsetSpecialChar(*this); }; /// And which kind is this? Kind kind_;