From df562f502a79dce1f96e68264aab8ea2cd28eee5 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 19 Feb 2023 19:00:02 +0100 Subject: [PATCH] Avoid a segfault while editing a ruler. This happens is both a selection and a transient selection is active. --- src/ant/ant/antObject.cc | 6 ++++++ src/ant/ant/antObject.h | 5 +++++ src/ant/ant/antService.cc | 2 ++ src/laybasic/laybasic/layAnnotationShapes.cc | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ant/ant/antObject.cc b/src/ant/ant/antObject.cc index 805c5afff..3a299e9ff 100644 --- a/src/ant/ant/antObject.cc +++ b/src/ant/ant/antObject.cc @@ -133,6 +133,12 @@ Object::Object (const ant::Object &d) // .. nothing else .. } +Object::~Object () +{ + // .. nothing yet .. +} + + Object & Object::operator= (const ant::Object &d) { diff --git a/src/ant/ant/antObject.h b/src/ant/ant/antObject.h index 2225cbf3f..4a2d25038 100644 --- a/src/ant/ant/antObject.h +++ b/src/ant/ant/antObject.h @@ -137,6 +137,11 @@ public: */ Object &operator= (const ant::Object &d); + /** + * @brief Destructor + */ + ~Object (); + /** * @brief Less operator */ diff --git a/src/ant/ant/antService.cc b/src/ant/ant/antService.cc index 65d47a6b9..95754b5c5 100644 --- a/src/ant/ant/antService.cc +++ b/src/ant/ant/antService.cc @@ -1009,6 +1009,7 @@ View::ruler (const ant::Object *r) void View::render (const lay::Viewport &vp, lay::ViewObjectCanvas &canvas) { + // .. nothing yet .. if (! mp_ruler) { return; } @@ -1700,6 +1701,7 @@ Service::end_move (const db::DPoint &, lay::angle_constraint_type) void Service::selection_to_view () { + clear_transient_selection (); annotation_selection_changed_event (); // the selection objects need to be recreated since we destroyed the old rulers diff --git a/src/laybasic/laybasic/layAnnotationShapes.cc b/src/laybasic/laybasic/layAnnotationShapes.cc index 1381e5ba6..da8a24b25 100644 --- a/src/laybasic/laybasic/layAnnotationShapes.cc +++ b/src/laybasic/laybasic/layAnnotationShapes.cc @@ -195,7 +195,7 @@ AnnotationShapes::replace (iterator pos, const shape_type &&sh) manager ()->queue (this, new AnnotationLayerOp (true /*insert*/, sh)); } invalidate_state (); // HINT: must come before the change is done! - m_layer.replace (pos, sh); + m_layer.replace (pos, std::move (sh)); } return *pos; }