commit c560e6b3a6ae36ad9a333fe98da3b8688dfa2236
Author: Richard Heck <[email protected]>
Date: Mon Jul 18 12:56:20 2016 -0400
Do not crash is release mode if we stumble across an unrealized font.
---
po/de.gmo | Bin 490433 -> 492574 bytes
po/ia.gmo | Bin 444082 -> 475598 bytes
po/sk.gmo | Bin 481868 -> 481868 bytes
src/frontends/qt4/GuiFontLoader.cpp | 23 ++++++++++++++++++-----
src/insets/InsetArgument.cpp | 6 +++++-
5 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/po/de.gmo b/po/de.gmo
index b8d7822..7e3719b 100644
Binary files a/po/de.gmo and b/po/de.gmo differ
diff --git a/po/ia.gmo b/po/ia.gmo
index eddcba4..80eb568 100644
Binary files a/po/ia.gmo and b/po/ia.gmo differ
diff --git a/po/sk.gmo b/po/sk.gmo
index bdda0b7..65335df 100644
Binary files a/po/sk.gmo and b/po/sk.gmo differ
diff --git a/src/frontends/qt4/GuiFontLoader.cpp
b/src/frontends/qt4/GuiFontLoader.cpp
index 9a662a8..148677b 100644
--- a/src/frontends/qt4/GuiFontLoader.cpp
+++ b/src/frontends/qt4/GuiFontLoader.cpp
@@ -95,11 +95,24 @@ static GuiFontInfo *
fontinfo_[NUM_FAMILIES][NUM_SERIES][NUM_SHAPE][NUM_SIZE];
// if not cached, create it.
GuiFontInfo & fontinfo(FontInfo const & f)
{
- // LASSERT: Is there anything we might do here besides crash?
- LBUFERR(f.family() < NUM_FAMILIES);
- LBUFERR(f.series() < NUM_SERIES);
- LBUFERR(f.realShape() < NUM_SHAPE);
- LBUFERR(f.size() < NUM_SIZE);
+ bool const fontIsRealized =
+ (f.family() < NUM_FAMILIES) &&
+ (f.series() < NUM_SERIES) &&
+ (f.realShape() < NUM_SHAPE) &&
+ (f.size() < NUM_SIZE);
+ if (!fontIsRealized) {
+ // We can reset the font to something sensible in release mode.
+ LATTEST(false);
+ LYXERR0("Unrealized font!");
+ // We could be fancier here, if we wanted, and just fix things where
+ // there is a problem. But it doesn't seem worth it, since we should
+ // not be here in the first place.
+ GuiFontInfo * & fi =
+
fontinfo_[sane_font.family()][sane_font.series()][sane_font.realShape()][sane_font.size()];
+ if (!fi)
+ fi = new GuiFontInfo(f);
+ return *fi;
+ }
// fi is a reference to the pointer type (GuiFontInfo *) in the
// fontinfo_ table.
GuiFontInfo * & fi =
diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp
index da807d2..13d17bb 100644
--- a/src/insets/InsetArgument.cpp
+++ b/src/insets/InsetArgument.cpp
@@ -104,7 +104,11 @@ void InsetArgument::updateBuffer(ParIterator const & it,
UpdateType utype)
name_ = convert<string>(ours);
}
}
- Layout::LaTeXArgMap::const_iterator const lait = args.find(name_);
+
+ // FIXME It does not look to me as if this needs to be redone
+ // over and over again. All the arguments are coming from the
+ // layout. If that changes....
+ Layout::LaTeXArgMap::const_iterator const lait = args.find(name_);
if (lait != args.end()) {
docstring label =
translateIfPossible((*lait).second.labelstring);
docstring striplabel;