From 3e80b896214d68d84a475b0c780f6770ad6ae397 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sat, 9 Apr 2011 03:46:06 +0200 Subject: Initialize cached patterns to NULL in NRStyle, should fix crashes (bzr r9508.1.80) --- src/display/nr-style.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/display/nr-style.cpp') diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp index 40366f5d3..72fa0c444 100644 --- a/src/display/nr-style.cpp +++ b/src/display/nr-style.cpp @@ -51,6 +51,8 @@ NRStyle::NRStyle() , fill_rule(CAIRO_FILL_RULE_EVEN_ODD) , line_cap(CAIRO_LINE_CAP_BUTT) , line_join(CAIRO_LINE_JOIN_MITER) + , fill_pattern(NULL) + , stroke_pattern(NULL) {} NRStyle::~NRStyle() @@ -198,8 +200,8 @@ void NRStyle::applyStroke(cairo_t *ct) void NRStyle::update() { // force pattern update - cairo_pattern_destroy(fill_pattern); - cairo_pattern_destroy(stroke_pattern); + if (fill_pattern) cairo_pattern_destroy(fill_pattern); + if (stroke_pattern) cairo_pattern_destroy(stroke_pattern); fill_pattern = NULL; stroke_pattern = NULL; } -- cgit v1.2.3