summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2018-10-30 12:44:06 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2018-10-30 16:12:56 +0100
commit02a2b75550e8e94e29d252178cfb223452812d2b (patch)
tree6377c79daa1aaa75cf94f6f2921fd10efe3c8579
parentb9e4bb65bcd7600f8e9150aa18ecd2527646ae05 (diff)
Fix SalLayoutGlyphs copy constructor
Since we can't know the real SalLayoutGlyphsImpl type, we always have to clone and delete it on assignemt and in the copy constructor. Change-Id: I3e3aa1e0271c5ecbb1474a70fae5e63bd7124677 Reviewed-on: https://gerrit.libreoffice.org/62583 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r--vcl/source/gdi/impglyphitem.cxx8
1 files changed, 3 insertions, 5 deletions
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 47125f6cd595..8955ea890a9f 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -26,14 +26,12 @@ SalLayoutGlyphs::SalLayoutGlyphs()
SalLayoutGlyphs::~SalLayoutGlyphs() { delete m_pImpl; }
-SalLayoutGlyphs::SalLayoutGlyphs(const SalLayoutGlyphs& rOther) { *m_pImpl = *rOther.m_pImpl; }
+SalLayoutGlyphs::SalLayoutGlyphs(const SalLayoutGlyphs& rOther) { operator=(rOther); }
SalLayoutGlyphs& SalLayoutGlyphs::operator=(const SalLayoutGlyphs& rOther)
{
- if (m_pImpl)
- *m_pImpl = *rOther.m_pImpl;
- else
- m_pImpl = rOther.m_pImpl->clone(*this);
+ delete m_pImpl;
+ m_pImpl = rOther.m_pImpl ? rOther.m_pImpl->clone(*this) : nullptr;
return *this;
}