summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qstatictext.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-06-30 14:26:54 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-01-14 12:48:02 (GMT)
commit30245b9fcfadaa7b400993aff05f8d1a54bea8d8 (patch)
treeeb39862f72d88dee89825ed1b61ce3c2fea04cb3 /src/gui/text/qstatictext.cpp
parent99d9f3c14ecebe72a2d10016b37d9a309f7a8c13 (diff)
downloadQt-30245b9fcfadaa7b400993aff05f8d1a54bea8d8.zip
Qt-30245b9fcfadaa7b400993aff05f8d1a54bea8d8.tar.gz
Qt-30245b9fcfadaa7b400993aff05f8d1a54bea8d8.tar.bz2
Fix memory leak
Diffstat (limited to 'src/gui/text/qstatictext.cpp')
-rw-r--r--src/gui/text/qstatictext.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index b6c123b..f953d71 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -133,7 +133,7 @@ QStaticText::QStaticText(const QStaticText &other)
Destroys the QStaticText.
*/
QStaticText::~QStaticText()
-{
+{
if (!d_ptr->ref.deref())
delete d_ptr;
}
@@ -261,10 +261,12 @@ QString QStaticText::toString() const
QStaticTextPrivate::QStaticTextPrivate()
: textLayout(new QTextLayout())
{
+ ref = 1;
}
QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other)
{
+ ref = 1;
textLayout = new QTextLayout(other.textLayout->text(), other.textLayout->font());
size = other.size;
}