summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-04-09 01:46:06 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-04-09 01:46:06 +0000
commit3e80b896214d68d84a475b0c780f6770ad6ae397 (patch)
tree70c9176760aefed532818ad588c8a1416d68ab7c /src/display
parentSlightly improve EXTRACT_ARGB32 macro (diff)
downloadinkscape-3e80b896214d68d84a475b0c780f6770ad6ae397.tar.gz
inkscape-3e80b896214d68d84a475b0c780f6770ad6ae397.zip
Initialize cached patterns to NULL in NRStyle, should fix crashes
(bzr r9508.1.80)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/nr-arena-shape.cpp3
-rw-r--r--src/display/nr-style.cpp6
2 files changed, 6 insertions, 3 deletions
diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp
index 227b49526..9055045f4 100644
--- a/src/display/nr-arena-shape.cpp
+++ b/src/display/nr-arena-shape.cpp
@@ -535,8 +535,9 @@ nr_arena_shape_set_style(NRArenaShape *shape, SPStyle *style)
{
g_return_if_fail(shape != NULL);
g_return_if_fail(NR_IS_ARENA_SHAPE(shape));
+ g_return_if_fail(style != NULL);
- if (style) sp_style_ref(style);
+ sp_style_ref(style);
if (shape->style) sp_style_unref(shape->style);
shape->style = style;
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;
}