mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
Make sure not to use a pointer that may be bogus
It may happen that mathedWordList is not still updated at load time, so we would still be using a bogus pointer. Better fetching the necessary info from the global macro table.
This commit is contained in:
parent
f2a263e334
commit
8ec91e804a
@ -614,9 +614,9 @@ void MathMacro::draw(PainterInfo & pi, int x, int y) const
|
|||||||
drawMarkers2(pi, expx, expy);
|
drawMarkers2(pi, expx, expy);
|
||||||
} else {
|
} else {
|
||||||
bool drawBox = lyxrc.macro_edit_style == LyXRC::MACRO_EDIT_INLINE_BOX;
|
bool drawBox = lyxrc.macro_edit_style == LyXRC::MACRO_EDIT_INLINE_BOX;
|
||||||
bool user_macro = mathedWordList().find(name()) == mathedWordList().end();
|
MacroData const * macro = MacroTable::globalMacros().get(name());
|
||||||
bool upshape = user_macro ? false : d->macro_ && d->macro_->symbol()
|
bool upshape = macro && macro->symbol()
|
||||||
&& d->macro_->symbol()->extra == "textmode";
|
&& macro->symbol()->extra == "textmode";
|
||||||
Changer dummy = pi.base.font.changeShape(upshape ? UP_SHAPE
|
Changer dummy = pi.base.font.changeShape(upshape ? UP_SHAPE
|
||||||
: pi.base.font.shape());
|
: pi.base.font.shape());
|
||||||
|
|
||||||
@ -930,11 +930,11 @@ bool MathMacro::folded() const
|
|||||||
|
|
||||||
void MathMacro::write(WriteStream & os) const
|
void MathMacro::write(WriteStream & os) const
|
||||||
{
|
{
|
||||||
bool user_macro = mathedWordList().find(name()) == mathedWordList().end();
|
MacroData const * macro = MacroTable::globalMacros().get(name());
|
||||||
bool textmode_macro = user_macro ? false : d->macro_ && d->macro_->symbol()
|
bool textmode_macro = macro && macro->symbol()
|
||||||
&& d->macro_->symbol()->extra == "textmode";
|
&& macro->symbol()->extra == "textmode";
|
||||||
bool needs_mathmode = user_macro ? bool(d->macro_) : d->macro_ && (!d->macro_->symbol()
|
bool needs_mathmode = macro && (!macro->symbol()
|
||||||
|| d->macro_->symbol()->extra != "textmode");
|
|| macro->symbol()->extra != "textmode");
|
||||||
|
|
||||||
MathEnsurer ensurer(os, needs_mathmode, true, textmode_macro);
|
MathEnsurer ensurer(os, needs_mathmode, true, textmode_macro);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user