mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-22 07:42:02 +00:00
Fix more possible crashes due to asInsetRef()
InsetMathHull has no method asInsetRef() and returns therefore 0. See also 447e0d03.
This commit is contained in:
parent
447e0d0308
commit
e409eedc5b
@ -256,13 +256,13 @@ pasteSelectionHelper(Cursor const & cur, ParagraphList const & parlist,
|
|||||||
if (ref->getParam("reference") == oldname)
|
if (ref->getParam("reference") == oldname)
|
||||||
ref->setParam("reference", newname);
|
ref->setParam("reference", newname);
|
||||||
} else if (itt->lyxCode() == MATH_REF_CODE) {
|
} else if (itt->lyxCode() == MATH_REF_CODE) {
|
||||||
InsetMathHull * mi = itt->asInsetMath()->asHullInset();
|
InsetMathRef * mi = itt->asInsetMath()->asRefInset();
|
||||||
// this is necessary to prevent an uninitialized
|
// this is necessary to prevent an uninitialized
|
||||||
// buffer when the RefInset is in a MathBox.
|
// buffer when the RefInset is in a MathBox.
|
||||||
// FIXME audit setBuffer calls
|
// FIXME audit setBuffer calls
|
||||||
mi->setBuffer(const_cast<Buffer &>(buffer));
|
mi->setBuffer(const_cast<Buffer &>(buffer));
|
||||||
if (mi->asRefInset()->getTarget() == oldname)
|
if (mi->getTarget() == oldname)
|
||||||
mi->asRefInset()->changeTarget(newname);
|
mi->changeTarget(newname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,14 +286,13 @@ pasteSelectionHelper(Cursor const & cur, ParagraphList const & parlist,
|
|||||||
if (ref.getParam("reference") == oldname)
|
if (ref.getParam("reference") == oldname)
|
||||||
ref.setParam("reference", newname);
|
ref.setParam("reference", newname);
|
||||||
} else if (itt->lyxCode() == MATH_REF_CODE) {
|
} else if (itt->lyxCode() == MATH_REF_CODE) {
|
||||||
InsetMathHull & mi =
|
InsetMathRef * mi = itt->asInsetMath()->asRefInset();
|
||||||
static_cast<InsetMathHull &>(*itt);
|
|
||||||
// this is necessary to prevent an uninitialized
|
// this is necessary to prevent an uninitialized
|
||||||
// buffer when the RefInset is in a MathBox.
|
// buffer when the RefInset is in a MathBox.
|
||||||
// FIXME audit setBuffer calls
|
// FIXME audit setBuffer calls
|
||||||
mi.setBuffer(const_cast<Buffer &>(buffer));
|
mi->setBuffer(const_cast<Buffer &>(buffer));
|
||||||
if (mi.asRefInset()->getTarget() == oldname)
|
if (mi->getTarget() == oldname)
|
||||||
mi.asRefInset()->changeTarget(newname);
|
mi->changeTarget(newname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user