From c0029ac3f264e69da837caaa2f193a07a8d58599 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Mon, 17 Jan 2005 18:27:31 +0000 Subject: [PATCH] Fix small mem leaks svn path=/trunk/kdegraphics/kpdf/; revision=379484 --- core/document.cpp | 10 ++++++++++ core/page.cpp | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/core/document.cpp b/core/document.cpp index f95281f39..3e7d814aa 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -88,6 +88,16 @@ KPDFDocument::KPDFDocument() KPDFDocument::~KPDFDocument() { closeDocument(); + + ObserverData *o; + QMap< int, ObserverData * >::iterator oIt; + while (d->observers.count() > 0) + { + oIt = d->observers.begin(); + o = *oIt; + d->observers.remove(oIt); + delete o; + } delete d; } diff --git a/core/page.cpp b/core/page.cpp index 28924b965..2756002ba 100644 --- a/core/page.cpp +++ b/core/page.cpp @@ -114,7 +114,9 @@ const QString KPDFPage::getTextInRect( const QRect & rect, double zoom ) const right = (int)((double)rect.right() / zoom), bottom = (int)((double)rect.bottom() / zoom); GString * text = m_text->getText( left, top, right, bottom ); - return QString::fromUtf8( text->getCString() ); + QString result = QString::fromUtf8( text->getCString() ); + delete text; + return result; }