From 30245b9fcfadaa7b400993aff05f8d1a54bea8d8 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 30 Jun 2009 16:26:54 +0200 Subject: Fix memory leak --- src/gui/text/qstatictext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; } -- cgit v0.12