[poppler] poppler/GfxFont.cc poppler/GfxFont.h

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Dec 16 11:38:08 PST 2008


 poppler/GfxFont.cc |    2 +-
 poppler/GfxFont.h  |   11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit 80f415176952635a485356cf36048eee53396c25
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Dec 16 20:37:39 2008 +0100

    Make destructors private/protected since you are not supposed to use them

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 9cfa4f9..9ae54e6 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -2054,7 +2054,7 @@ GfxFontDict::GfxFontDict(XRef *xref, Ref *fontDictRef, Dict *fontDict) {
 	// NULL and !isOk() so that when we do lookups
 	// we can tell the difference between a missing font
 	// and a font that is just !isOk()
-	delete fonts[i];
+	fonts[i]->decRefCnt();
 	fonts[i] = NULL;
       }
     } else {
diff --git a/poppler/GfxFont.h b/poppler/GfxFont.h
index 75a35d2..55f8692 100644
--- a/poppler/GfxFont.h
+++ b/poppler/GfxFont.h
@@ -135,8 +135,6 @@ public:
 
   GfxFont(char *tagA, Ref idA, GooString *nameA);
 
-  virtual ~GfxFont();
-
   GBool isOk() { return ok; }
 
   void incRefCnt();
@@ -229,6 +227,8 @@ public:
   DisplayFontParam *dfp;
 protected:
 
+  virtual ~GfxFont();
+
   void readFontDescriptor(XRef *xref, Dict *fontDict);
   CharCodeToUnicode *readToUnicodeCMap(Dict *fontDict, int nBits,
 				       CharCodeToUnicode *ctu);
@@ -265,8 +265,6 @@ public:
   Gfx8BitFont(XRef *xref, char *tagA, Ref idA, GooString *nameA,
 	      GfxFontType typeA, Dict *fontDict);
 
-  virtual ~Gfx8BitFont();
-
   virtual int getNextChar(char *s, int len, CharCode *code,
 			  Unicode **u, int *uLen,
 			  double *dx, double *dy, double *ox, double *oy);
@@ -303,6 +301,7 @@ public:
   Dict *getResources();
 
 private:
+  virtual ~Gfx8BitFont();
 
   char *enc[256];		// char code --> char name
   char encFree[256];		// boolean for each char name: if set,
@@ -325,8 +324,6 @@ public:
   GfxCIDFont(XRef *xref, char *tagA, Ref idA, GooString *nameA,
 	     Dict *fontDict);
 
-  virtual ~GfxCIDFont();
-
   virtual GBool isCIDFont() { return gTrue; }
 
   virtual int getNextChar(char *s, int len, CharCode *code,
@@ -352,6 +349,8 @@ public:
   double getWidth(char* s, int len);
 
 private:
+  virtual ~GfxCIDFont();
+
   Gushort mapCodeToGID(FoFiTrueType *ff, int cmapi,
     Unicode unicode, GBool wmode);
 


More information about the poppler mailing list