From: buliabyak Date: Fri, 5 Sep 2008 19:48:07 +0000 (+0000) Subject: fix crash: separate np and kh listeners so that np listener is not fired twice when... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4018f29ab098a73c3d33c99b44022d24ace273e5;p=inkscape.git fix crash: separate np and kh listeners so that np listener is not fired twice when a path with pattern fill is edited --- diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index 91fdeca35..c9a4fe557 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -168,12 +168,11 @@ bool ShapeEditor::nodepath_edits_repr_key(gchar const *name) { return false; } -static void shapeeditor_event_attr_changed(Inkscape::XML::Node */*repr*/, gchar const *name, +static void shapeeditor_np_event_attr_changed(Inkscape::XML::Node */*repr*/, gchar const *name, gchar const */*old_value*/, gchar const */*new_value*/, bool /*is_interactive*/, gpointer data) { gboolean changed_np = FALSE; - gboolean changed_kh = FALSE; g_assert(data); ShapeEditor *sh = ((ShapeEditor *) data); @@ -182,7 +181,6 @@ static void shapeeditor_event_attr_changed(Inkscape::XML::Node */*repr*/, gchar { changed_np = !sh->has_local_change(SH_NODEPATH); sh->decrement_local_change(SH_NODEPATH); - } if (changed_np) { @@ -199,6 +197,17 @@ static void shapeeditor_event_attr_changed(Inkscape::XML::Node */*repr*/, gchar } } + sh->update_statusbar(); //TODO: sh->get_container()->update_statusbar(); +} + +static void shapeeditor_kh_event_attr_changed(Inkscape::XML::Node */*repr*/, gchar const *name, + gchar const */*old_value*/, gchar const */*new_value*/, + bool /*is_interactive*/, gpointer data) +{ + gboolean changed_kh = FALSE; + + g_assert(data); + ShapeEditor *sh = ((ShapeEditor *) data); if (sh->has_knotholder()) { @@ -214,10 +223,20 @@ static void shapeeditor_event_attr_changed(Inkscape::XML::Node */*repr*/, gchar sh->update_statusbar(); //TODO: sh->get_container()->update_statusbar(); } -static Inkscape::XML::NodeEventVector shapeeditor_repr_events = { + + +static Inkscape::XML::NodeEventVector shapeeditor_np_repr_events = { + NULL, /* child_added */ + NULL, /* child_removed */ + shapeeditor_np_event_attr_changed, + NULL, /* content_changed */ + NULL /* order_changed */ +}; + +static Inkscape::XML::NodeEventVector shapeeditor_kh_repr_events = { NULL, /* child_added */ NULL, /* child_removed */ - shapeeditor_event_attr_changed, + shapeeditor_kh_event_attr_changed, NULL, /* content_changed */ NULL /* order_changed */ }; @@ -243,7 +262,7 @@ void ShapeEditor::set_item(SPItem *item, SubType type, bool keep_knotholder) { // setting new listener repr = SP_OBJECT_REPR(item); Inkscape::GC::anchor(repr); - sp_repr_add_listener(repr, &shapeeditor_repr_events, this); + sp_repr_add_listener(repr, &shapeeditor_np_repr_events, this); } break; @@ -257,7 +276,7 @@ void ShapeEditor::set_item(SPItem *item, SubType type, bool keep_knotholder) { // setting new listener repr = this->knotholder->repr; Inkscape::GC::anchor(repr); - sp_repr_add_listener(repr, &shapeeditor_repr_events, this); + sp_repr_add_listener(repr, &shapeeditor_kh_repr_events, this); } break; } @@ -284,7 +303,7 @@ void ShapeEditor::set_item_lpe_path_parameter(SPItem *item, SPObject *lpeobject, Inkscape::XML::Node *repr = SP_OBJECT_REPR(lpeobject); if (repr) { Inkscape::GC::anchor(repr); - sp_repr_add_listener(repr, &shapeeditor_repr_events, this); + sp_repr_add_listener(repr, &shapeeditor_np_repr_events, this); } } }