Do not crash is release mode if we stumble across an unrealized font.

(cherry picked from commit 3203fb1c5f)
This commit is contained in:
Richard Heck 2016-07-18 13:01:42 -04:00
parent 4604388e7c
commit 32b56ee8f7
2 changed files with 20 additions and 5 deletions

View File

@ -95,11 +95,24 @@ static GuiFontInfo * fontinfo_[NUM_FAMILIES][NUM_SERIES][NUM_SHAPE][NUM_SIZE];
// if not cached, create it. // if not cached, create it.
GuiFontInfo & fontinfo(FontInfo const & f) GuiFontInfo & fontinfo(FontInfo const & f)
{ {
// LASSERT: Is there anything we might do here besides crash? bool const fontIsRealized =
LBUFERR(f.family() < NUM_FAMILIES); (f.family() < NUM_FAMILIES) &&
LBUFERR(f.series() < NUM_SERIES); (f.series() < NUM_SERIES) &&
LBUFERR(f.realShape() < NUM_SHAPE); (f.realShape() < NUM_SHAPE) &&
LBUFERR(f.size() < NUM_SIZE); (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 // fi is a reference to the pointer type (GuiFontInfo *) in the
// fontinfo_ table. // fontinfo_ table.
GuiFontInfo * & fi = GuiFontInfo * & fi =

View File

@ -40,6 +40,8 @@ What's new
* USER INTERFACE * USER INTERFACE
- Avoid crashing in release mode if we stumble across an unrealized font.
- Fix display of citations with two authors. - Fix display of citations with two authors.
- Fix display of multi-author citations when the GUI language is not English. - Fix display of multi-author citations when the GUI language is not English.