view src/poppler-qt4-globalparams.patch @ 2423:1ef908a16c3d

New package: poppler
author Stefan Löffler <st.loeffler@gmail.com>
date Tue, 17 Apr 2012 21:07:25 +0200
parents
children
line wrap: on
line source

diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index 04c56c6..d1d45d9 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -46,6 +46,7 @@
 namespace Poppler {
 
   int DocumentData::count = 0;
+  GBool DocumentData::ownGlobalParams = gFalse;
 
   Document *Document::load(const QString &filePath, const QByteArray &ownerPassword,
 			   const QByteArray &userPassword)
diff --git a/qt4/src/poppler-private.cc b/qt4/src/poppler-private.cc
index d6e3265..075b3fd 100644
--- a/qt4/src/poppler-private.cc
+++ b/qt4/src/poppler-private.cc
@@ -234,8 +234,13 @@ namespace Debug {
         count --;
         if ( count == 0 )
         {
-            utf8Map = 0;
-            delete globalParams;
+            if ( ownGlobalParams )
+            {
+                utf8Map = 0;
+                delete globalParams;
+                globalParams = NULL;
+                ownGlobalParams = gFalse;
+            }
         }
       }
     
@@ -250,8 +255,12 @@ namespace Debug {
       
         if ( count == 0 )
         {
-            utf8Map = 0;
-            globalParams = new GlobalParams();
+            if ( !globalParams )
+            {
+                utf8Map = 0;
+                globalParams = new GlobalParams();
+                ownGlobalParams = gTrue;
+            }
             setErrorFunction(qt4ErrorFunction);
         }
         count ++;
diff --git a/qt4/src/poppler-private.h b/qt4/src/poppler-private.h
index 7d0b1a3..9614e38 100644
--- a/qt4/src/poppler-private.h
+++ b/qt4/src/poppler-private.h
@@ -197,6 +197,7 @@ namespace Poppler {
 	QColor paperColor;
 	int m_hints;
 	static int count;
+	static GBool ownGlobalParams;
     };
 
     class FontInfoData