From: buliabyak Date: Sun, 20 Jul 2008 16:36:22 +0000 (+0000) Subject: fix stupid crash, make get_item const X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cb4442f3753d46e6329105bd7a71fc51ed0d6dfa;p=inkscape.git fix stupid crash, make get_item const --- diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp index 77419d1d1..27e1dd399 100644 --- a/src/shape-editor.cpp +++ b/src/shape-editor.cpp @@ -130,8 +130,8 @@ void ShapeEditor::decrement_local_change (SubType type) { } } -SPItem *ShapeEditor::get_item (SubType type) { - SPItem *item = NULL; +const SPItem *ShapeEditor::get_item (SubType type) { + const SPItem *item = NULL; switch (type) { case SH_NODEPATH: if (this->has_nodepath()) { @@ -140,7 +140,7 @@ SPItem *ShapeEditor::get_item (SubType type) { break; case SH_KNOTHOLDER: if (this->has_knotholder()) { - item = this->nodepath->item; + item = this->knotholder->getItem(); } break; } @@ -329,8 +329,8 @@ void ShapeEditor::reset_item (SubType type, bool keep_knotholder) break; case SH_KNOTHOLDER: if (this->knotholder) { - SPItem * item = get_item(SH_KNOTHOLDER); - set_item(item, SH_KNOTHOLDER, keep_knotholder); + const SPItem * item = get_item(SH_KNOTHOLDER); + set_item((SPItem *) item, SH_KNOTHOLDER, keep_knotholder); } break; } @@ -350,7 +350,7 @@ bool ShapeEditor::is_over_stroke (NR::Point event_p, bool remember) { if (!this->nodepath) return false; // no stroke in knotholder - SPItem *item = get_item(SH_NODEPATH); + const SPItem *item = get_item(SH_NODEPATH); //Translate click point into proper coord system this->curvepoint_doc = desktop->w2d(event_p); diff --git a/src/shape-editor.h b/src/shape-editor.h index 918102761..2a6da68c3 100644 --- a/src/shape-editor.h +++ b/src/shape-editor.h @@ -44,7 +44,7 @@ public: void reset_item (SubType type, bool keep_knotholder = true); void unset_item (SubType type, bool keep_knotholder = false); - SPItem *get_item (SubType type); + const SPItem *get_item (SubType type); bool has_nodepath (); bool has_knotholder ();