[poppler] poppler/CairoOutputDev.cc poppler/CairoOutputDev.h

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Thu Jun 19 01:46:54 PDT 2008


 poppler/CairoOutputDev.cc |    4 ++--
 poppler/CairoOutputDev.h  |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit d6fb5dcb7b7596961800d9744d17b6adb8d9a2ad
Author: Michael Vrable <mvrable at cs.ucsd.edu>
Date:   Wed Jun 18 11:24:05 2008 -0700

    Fix a crash in the cairo backend with Type 3 glyphs
    
    Commit 86b7e8a3bee7 ("Ensure cairo renders Type 3 glyphs with only the fill
    color") introduced a bug into the Cairo backend, causing evince to crash
    with the message
        evince: cairo-pattern.c:679: cairo_pattern_destroy: Assertion
        `((*&(&pattern->ref_count)->ref_count) > 0)' failed.
    Fix this by updating reference counts to the fill and stroke patterns when
    modifying them in beginType3Char.
    
    Simplify the code as well by not saving the old stroke pattern before
    overriding it; this is already done since beginType3Char/endType3Char is
    wrapped by calls to saveState/restoreState in Gfx::doShowText.

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 05fe1a8..7ae19a2 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -616,13 +616,13 @@ GBool CairoOutputDev::beginType3Char(GfxState *state, double x, double y,
     cairo_set_matrix(cairo_shape, &orig_matrix);
     cairo_transform(cairo_shape, &matrix);
   }
-  old_stroke_pattern = stroke_pattern;
+  cairo_pattern_destroy(stroke_pattern);
+  cairo_pattern_reference(fill_pattern);
   stroke_pattern = fill_pattern;
   return gFalse;
 }
 
 void CairoOutputDev::endType3Char(GfxState *state) {
-  stroke_pattern = old_stroke_pattern;
   cairo_restore (cairo);
   if (cairo_shape) {
     cairo_restore (cairo_shape);
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index f6f9e13..5d2b658 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -199,7 +199,7 @@ protected:
   void doPath(cairo_t *cairo, GfxState *state, GfxPath *path);
   
   GfxRGB fill_color, stroke_color;
-  cairo_pattern_t *fill_pattern, *stroke_pattern, *old_stroke_pattern;
+  cairo_pattern_t *fill_pattern, *stroke_pattern;
   double fill_opacity;
   double stroke_opacity;
   CairoFont *currentFont;


More information about the poppler mailing list