summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-12-11 09:16:30 +0000
committerjabiertxof <info@marker.es>2015-12-11 09:16:30 +0000
commit678ace57cb2e98572d3e5c30138b3100aceef1ed (patch)
treeece8baa850d6b7233fc709172be6bc3c8759990f /src
parentClean up some code, only init the SPKnot in one place. (diff)
downloadinkscape-678ace57cb2e98572d3e5c30138b3100aceef1ed.tar.gz
inkscape-678ace57cb2e98572d3e5c30138b3100aceef1ed.zip
Fix crash on hidden guides
(bzr r14527)
Diffstat (limited to 'src')
-rw-r--r--src/display/guideline.cpp46
-rw-r--r--src/sp-guide.cpp7
2 files changed, 29 insertions, 24 deletions
diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp
index fd6ccf164..4b573a586 100644
--- a/src/display/guideline.cpp
+++ b/src/display/guideline.cpp
@@ -172,31 +172,32 @@ static void sp_guideline_update(SPCanvasItem *item, Geom::Affine const &affine,
if ((SP_CANVAS_ITEM_CLASS(sp_guideline_parent_class))->update) {
(SP_CANVAS_ITEM_CLASS(sp_guideline_parent_class))->update(item, affine, flags);
}
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ if (desktop && item->visible) {
+ if (!gl->origin) {
+ gl->origin = new SPKnot(desktop, "No tip yet!! XXX");
+
+ gl->origin->setAnchor(SP_ANCHOR_CENTER);
+ gl->origin->setMode(SP_CTRL_MODE_COLOR);
+ gl->origin->setFill(0xffffff80, 0xffffffff, 0xffffff80);
+ gl->origin->request_signal.connect(sigc::bind(sigc::ptr_fun(sp_guideline_origin_move), gl));
+ }
- gl->affine = affine;
-
- if (!gl->origin){
- gl->origin = new SPKnot(SP_ACTIVE_DESKTOP, "No tip yet!! XXX");
-
- gl->origin->setAnchor(SP_ANCHOR_CENTER);
- gl->origin->setMode(SP_CTRL_MODE_COLOR);
- gl->origin->setFill(0xffffff80, 0xffffffff, 0xffffff80);
- gl->origin->request_signal.connect(sigc::bind(sigc::ptr_fun(sp_guideline_origin_move), gl));
- }
-
- if (gl->locked) {
- gl->origin->setStroke(0x0000ff88, 0x0000ff88, 0x0000ff88);
- gl->origin->setShape(SP_CTRL_SHAPE_CROSS);
- gl->origin->setSize(6);
- } else {
- gl->origin->setStroke(0xff000088, 0xff0000ff, 0xff0000ff);
- gl->origin->setShape(SP_CTRL_SHAPE_CIRCLE);
- gl->origin->setSize(4);
+ if (gl->locked) {
+ gl->origin->setStroke(0x0000ff88, 0x0000ff88, 0x0000ff88);
+ gl->origin->setShape(SP_CTRL_SHAPE_CROSS);
+ gl->origin->setSize(6);
+ } else {
+ gl->origin->setStroke(0xff000088, 0xff0000ff, 0xff0000ff);
+ gl->origin->setShape(SP_CTRL_SHAPE_CIRCLE);
+ gl->origin->setSize(4);
+ }
+ gl->origin->moveto(gl->point_on_line);
+ gl->origin->updateCtrl();
}
- gl->origin->moveto(gl->point_on_line);
- gl->origin->updateCtrl();
- Geom::Point pol_transformed = gl->point_on_line*affine;
+ gl->affine = affine;
+ Geom::Point pol_transformed = gl->point_on_line * affine;
if (gl->is_horizontal()) {
sp_canvas_update_bbox (item, -1000000, round(pol_transformed[Geom::Y] - 16), 1000000, round(pol_transformed[Geom::Y] + 1));
} else if (gl->is_vertical()) {
@@ -205,7 +206,6 @@ static void sp_guideline_update(SPCanvasItem *item, Geom::Affine const &affine,
//TODO: labels in angled guidelines are not showing up for some reason.
sp_canvas_update_bbox (item, -1000000, -1000000, 1000000, 1000000);
}
-
}
// Returns 0.0 if point is on the guideline
diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp
index b8990a461..a57947e01 100644
--- a/src/sp-guide.cpp
+++ b/src/sp-guide.cpp
@@ -290,6 +290,9 @@ void SPGuide::showSPGuide()
sp_canvas_item_show(SP_CANVAS_ITEM(*it));
if((*it)->origin) {
(*it)->origin->show();
+ } else {
+ //reposition to same place to show knots
+ sp_guideline_set_position(*it, point_on_line);
}
}
}
@@ -313,7 +316,9 @@ void SPGuide::hideSPGuide()
{
for(std::vector<SPGuideLine *>::const_iterator it = this->views.begin(); it != this->views.end(); ++it) {
sp_canvas_item_hide(SP_CANVAS_ITEM(*it));
- (*it)->origin->hide();
+ if ((*it)->origin) {
+ (*it)->origin->hide();
+ }
}
}