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; }