Commit 90651576 authored by Albert Astals Cid's avatar Albert Astals Cid

* qt4/src/poppler-document.cc: leak--

        * qt4/src/poppler-private.h: Refcount globalparams
        * qt4/tests/test-poppler-qt4.cpp: Some leaks less
parent 46fd63c4
2006-05-13 Albert Astals Cid <aacid@kde.org>
* qt4/src/poppler-document.cc: leak--
* qt4/src/poppler-private.h: Refcount globalparams
* qt4/tests/test-poppler-qt4.cpp: Some leaks less
2006-05-12 Albert Astals Cid <aacid@kde.org>
* qt4/src/Makefile.am
......
......@@ -41,13 +41,11 @@
namespace Poppler {
int DocumentData::count = 0;
Document *Document::load(const QString &filePath, const QByteArray &ownerPassword,
const QByteArray &userPassword)
{
if (!globalParams) {
globalParams = new GlobalParams("/etc/xpdfrc");
}
DocumentData *doc = new DocumentData(new GooString(QFile::encodeName(filePath)),
new GooString(ownerPassword.data()),
new GooString(userPassword.data()));
......@@ -286,7 +284,9 @@ namespace Poppler {
if ( infoDict->lookup( type.toLatin1().data(), &obj )->isString() )
{
result = Poppler::convertDate(UGooString(*obj.getString()).getCString());
char *aux = UGooString(*obj.getString()).getCString();
result = Poppler::convertDate(aux);
delete[] aux;
}
obj.free();
info.free();
......
......@@ -21,6 +21,7 @@
*/
#include <GfxState.h>
#include <GlobalParams.h>
#include <Link.h>
#include <Outline.h>
#include <PDFDoc.h>
......@@ -71,6 +72,9 @@ namespace Poppler {
// It might be more appropriate to delete these in PDFDoc
delete ownerPassword;
delete userPassword;
if ( count == 0 ) globalParams = new GlobalParams("/etc/xpdfrc");
count ++;
}
~DocumentData()
......@@ -78,6 +82,9 @@ namespace Poppler {
qDeleteAll(m_embeddedFiles);
delete m_splashOutputDev;
delete m_fontInfoScanner;
count --;
if ( count == 0 ) delete globalParams;
}
SplashOutputDev *getSplashOutputDev()
......@@ -165,6 +172,7 @@ namespace Poppler {
SplashOutputDev *m_splashOutputDev;
QList<EmbeddedFile*> m_embeddedFiles;
QColor paperColor;
static int count;
};
class FontInfoData
......
......@@ -25,6 +25,7 @@ private:
PDFDisplay::PDFDisplay( Poppler::Document *d, bool arthur )
{
doc = d;
pixmap = 0;
m_currentPage = 0;
useArthur = arthur;
display();
......@@ -35,16 +36,16 @@ void PDFDisplay::display()
if (doc) {
Poppler::Page *page = doc->page(m_currentPage);
if (page) {
pixmap = new QPixmap(page->pageSize());
if (useArthur)
{
qDebug() << "Displaying page using Arthur backend: " << m_currentPage;
pixmap = new QPixmap(page->pageSize());
page->renderToPixmap(pixmap, 72.0, 72.0);
}
else
{
qDebug() << "Displaying page using Splash backend: " << m_currentPage;
delete pixmap;
delete pixmap;
pixmap = page->splashRenderToPixmap();
}
update();
......@@ -140,6 +141,7 @@ int main( int argc, char **argv )
Poppler::Page *page = doc->page(0);
qDebug() << " Page 1 size: " << page->pageSize().width()/72 << "inches x " << page->pageSize().height()/72 << "inches";
delete page;
if (argc == 2 || (argc == 3 && strcmp(argv[2], "-arthur") == 0))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment