From 87d97322ef360f87a2445858aa30444fa214d096 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Fri, 23 Mar 2012 21:15:55 +0100 Subject: [PATCH] Fix more possible crashes due to asInsetRef() InsetMathHull has no method asInsetRef() and returns therefore 0. See also 5bd68605. --- src/CutAndPaste.cpp | 15 +++++++-------- status.20x | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/CutAndPaste.cpp b/src/CutAndPaste.cpp index f3163c162a..c767c93be7 100644 --- a/src/CutAndPaste.cpp +++ b/src/CutAndPaste.cpp @@ -255,13 +255,13 @@ pasteSelectionHelper(Cursor const & cur, ParagraphList const & parlist, if (ref->getParam("reference") == oldname) ref->setParam("reference", newname); } else if (itt->lyxCode() == MATH_REF_CODE) { - InsetMathHull * mi = itt->asInsetMath()->asHullInset(); + InsetMathRef * mi = itt->asInsetMath()->asRefInset(); // this is necessary to prevent an uninitialized // buffer when the RefInset is in a MathBox. // FIXME audit setBuffer calls mi->setBuffer(const_cast(buffer)); - if (mi->asRefInset()->getTarget() == oldname) - mi->asRefInset()->changeTarget(newname); + if (mi->getTarget() == oldname) + mi->changeTarget(newname); } } } @@ -285,14 +285,13 @@ pasteSelectionHelper(Cursor const & cur, ParagraphList const & parlist, if (ref.getParam("reference") == oldname) ref.setParam("reference", newname); } else if (itt->lyxCode() == MATH_REF_CODE) { - InsetMathHull & mi = - static_cast(*itt); + InsetMathRef * mi = itt->asInsetMath()->asRefInset(); // this is necessary to prevent an uninitialized // buffer when the RefInset is in a MathBox. // FIXME audit setBuffer calls - mi.setBuffer(const_cast(buffer)); - if (mi.asRefInset()->getTarget() == oldname) - mi.asRefInset()->changeTarget(newname); + mi->setBuffer(const_cast(buffer)); + if (mi->getTarget() == oldname) + mi->changeTarget(newname); } } break; diff --git a/status.20x b/status.20x index fa47388a53..0c263f22c8 100644 --- a/status.20x +++ b/status.20x @@ -74,8 +74,8 @@ What's new * USER INTERFACE -- Fixed crash when modifying equation label and there are references to that - label in math (bug 8095). +- Fixed crash when modifying or pasting an equation label and there + are references to that label in math (bug 8095). - Do not disable View/Update Other Formats button when "Use non-TeX fonts" is active (bug 8069). -- 2.39.5