From c784e87f3b53e823dfb303e296ede834accc9322 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 26 Dec 2014 15:44:07 +0100 Subject: SPStyle ref counting clean up. (bzr r13822.1.7) --- src/display/drawing-item.cpp | 10 ++++++---- src/display/nr-filter-primitive.cpp | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/display') diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index 83d4744c9..89ca66dc4 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -366,10 +366,12 @@ DrawingItem::setStyle(SPStyle *style, SPStyle *context_style) // std::cout << "DrawingItem::setStyle: " << name() << " " << style // << " " << context_style << std::endl; - if (style) sp_style_ref(style); - if (_style) sp_style_unref(_style); - _style = style; - + if( style != _style ) { + if (style) sp_style_ref(style); + if (_style) sp_style_unref(_style); + _style = style; + } + if (style && style->filter.set && style->getFilter()) { if (!_filter) { int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter())); diff --git a/src/display/nr-filter-primitive.cpp b/src/display/nr-filter-primitive.cpp index 3033118e4..c8b569036 100644 --- a/src/display/nr-filter-primitive.cpp +++ b/src/display/nr-filter-primitive.cpp @@ -171,9 +171,11 @@ Geom::Rect FilterPrimitive::filter_primitive_area(FilterUnits const &units) void FilterPrimitive::setStyle(SPStyle *style) { - if (style) sp_style_ref(style); - if (_style) sp_style_unref(_style); - _style = style; + if( style != _style ) { + if (style) sp_style_ref(style); + if (_style) sp_style_unref(_style); + _style = style; + } } -- cgit v1.2.3