[poppler] poppler/qt4/src: poppler-document.cc, 1.11, 1.12 poppler-private.h, 1.1, 1.2 poppler-qt4.h, 1.19, 1.20

Brad Hards bradh at freedesktop.org
Wed Dec 28 01:23:45 PST 2005


Update of /cvs/poppler/poppler/qt4/src
In directory gabe:/tmp/cvs-serv20360/qt4/src

Modified Files:
	poppler-document.cc poppler-private.h poppler-qt4.h 
Log Message:
Plug a few memory leaks in the Qt4 bindings.


Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-document.cc,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- poppler-document.cc	27 Dec 2005 06:10:01 -0000	1.11
+++ poppler-document.cc	28 Dec 2005 09:23:43 -0000	1.12
@@ -53,6 +53,7 @@
 	    return pdoc;
 	}
 	else
+	    delete doc;
 	    return NULL;
 
     }
@@ -64,6 +65,7 @@
 
     Document::~Document()
     {
+	delete m_doc->m_fontInfoScanner;
 	delete m_doc;
     }
 
@@ -170,6 +172,7 @@
 			      (Poppler::FontInfo::Type)((::FontInfo*)items->get(i))->getType()
 		));
 	}
+	deleteGooList(items, ::FontInfo);
 	return true;
     }
 

Index: poppler-private.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-private.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- poppler-private.h	28 Jun 2005 10:00:09 -0000	1.1
+++ poppler-private.h	28 Dec 2005 09:23:43 -0000	1.2
@@ -25,7 +25,12 @@
     class DocumentData {
     public:
 	DocumentData(GooString *filePath, GooString *ownerPassword, GooString *userPassword) :
-	    doc(filePath, ownerPassword, userPassword) {}
+	    doc(filePath, ownerPassword, userPassword)
+	    {
+		// It might be more appropriate to delete these in PDFDoc
+		delete ownerPassword;
+		delete userPassword;
+	    }
 	class PDFDoc doc;
 	bool locked;
 	FontInfoScanner *m_fontInfoScanner;

Index: poppler-qt4.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-qt4.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- poppler-qt4.h	27 Dec 2005 06:10:01 -0000	1.19
+++ poppler-qt4.h	28 Dec 2005 09:23:43 -0000	1.20
@@ -326,6 +326,9 @@
 	   Load the document from a file on disk
 
 	   \param filePath the name (and path, if required) of the file to load
+
+	   \warning The application owns the pointer to Document, and this should
+	   be deleted when no longer required.
 	*/
 	static Document *Document::load(const QString & filePath,
 					const QByteArray &ownerPassword=QByteArray(),



More information about the poppler mailing list