summaryrefslogtreecommitdiffstats
path: root/src/node-context.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-01-05 13:46:30 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-01-05 13:46:30 +0000
commit9cb142e8a749d329a7978ddd1cb43d68cf38920b (patch)
tree3f3abbc18730c8139bf5e484a78a7cf0f2b7e9bd /src/node-context.cpp
parentport the fix from sp-text.cpp rev 11260 to fix bug 1628173 (diff)
downloadinkscape-9cb142e8a749d329a7978ddd1cb43d68cf38920b.tar.gz
inkscape-9cb142e8a749d329a7978ddd1cb43d68cf38920b.zip
robustize remembering the dragged segment - store node number, not pointer; fixes crash 1505549
(bzr r2134)
Diffstat (limited to 'src/node-context.cpp')
-rw-r--r--src/node-context.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/node-context.cpp b/src/node-context.cpp
index 2b30d067b..a4a51f676 100644
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
@@ -134,6 +134,7 @@ sp_node_context_dispose(GObject *object)
}
if (nc->nodepath) {
+ nc->grab_node = -1;
sp_nodepath_destroy(nc->nodepath);
nc->nodepath = NULL;
}
@@ -164,6 +165,7 @@ sp_node_context_setup(SPEventContext *ec)
Inkscape::Selection *selection = sp_desktop_selection(ec->desktop);
SPItem *item = selection->singleItem();
+ nc->grab_node = -1;
nc->nodepath = NULL;
ec->shape_knot_holder = NULL;
@@ -223,6 +225,7 @@ sp_node_context_selection_changed(Inkscape::Selection *selection, gpointer data)
if (nc->nodepath) {
old_repr = nc->nodepath->repr;
+ nc->grab_node = -1;
sp_nodepath_destroy(nc->nodepath);
nc->nodepath = NULL;
}
@@ -240,6 +243,7 @@ sp_node_context_selection_changed(Inkscape::Selection *selection, gpointer data)
SPItem *item = selection->singleItem();
SPDesktop *desktop = selection->desktop();
+ nc->grab_node = -1;
nc->nodepath = NULL;
ec->shape_knot_holder = NULL;
if (item) {
@@ -281,6 +285,7 @@ sp_nodepath_update_from_item(SPNodeContext *nc, SPItem *item)
g_assert(desktop);
if (nc->nodepath) {
+ nc->grab_node = -1;
sp_nodepath_destroy(nc->nodepath);
nc->nodepath = NULL;
}
@@ -395,7 +400,7 @@ sp_node_context_is_over_stroke (SPNodeContext *nc, SPItem *item, NR::Point event
nc->curvepoint_event[NR::Y] = (gint) event_p [NR::Y];
nc->hit = true;
nc->grab_t = position.assume().t;
- nc->grab_node = sp_nodepath_get_node_by_index(position.assume().piece);
+ nc->grab_node = position.assume().piece;
}
return close;
@@ -588,6 +593,9 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
switch (nc->current_state) {
case SP_NODE_CONTEXT_NODE_DRAGGING:
{
+ if (nc->grab_node == -1) // don't know which segment to drag
+ break;
+
// We round off the extra precision in the motion coordinates provided
// by some input devices (like tablets). As we'll store the coordinates
// as integers in curvepoint_event we need to do this rounding before