crash fix

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5657 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-11-17 10:34:17 +00:00
parent bc3e15c4c8
commit 17f88711bc
4 changed files with 22 additions and 17 deletions

View File

@ -1,3 +1,8 @@
2002-11-17 John Levon <levon@movementarian.org>
* qfont_loader.h:
* qfont_loader.C: fix totally broken update code
2002-11-17 John Levon <levon@movementarian.org>
* Makefile.am:

View File

@ -103,11 +103,6 @@ QDocumentDialog::QDocumentDialog(QDocument * form)
titleL->setFont(f);
setTitle(LAYOUT);
// FIXME: Edwin, please change this by making each module have
// a change_adaptor(), and connecting inside designer; then
// connect each module's change_adaptor to the main form's
// one here.
// preamble
connect(preambleModule->preambleMLE, SIGNAL(textChanged()),
this , SLOT(change_adaptor()));

View File

@ -38,6 +38,15 @@ using std::endl;
qfont_loader::qfont_loader()
{
for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1) {
for (int i2 = 0; i2 < 2; ++i2) {
for (int i3 = 0; i3 < 4; ++i3) {
for (int i4 = 0; i4 < 10; ++i4) {
fontinfo_[i1][i2][i3][i4] = 0;
}
}
}
}
}
@ -48,18 +57,16 @@ qfont_loader::~qfont_loader()
void qfont_loader::update()
{
#warning crashes ????
#if 0
for (int i1 = 0; i1 < LyXFont::NUM_FAMILIES; ++i1) {
for (int i2 = 0; i1 < 2; ++i2) {
for (int i3 = 0; i1 < 4; ++i3) {
for (int i4 = 0; i1 < 10; ++i4) {
fontinfo_[i1][i2][i3][i4].reset(0);
for (int i2 = 0; i2 < 2; ++i2) {
for (int i3 = 0; i3 < 4; ++i3) {
for (int i4 = 0; i4 < 10; ++i4) {
delete fontinfo_[i1][i2][i3][i4];
fontinfo_[i1][i2][i3][i4] = 0;
}
}
}
}
#endif
}
@ -222,10 +229,10 @@ qfont_loader::font_info const * qfont_loader::getfontinfo(LyXFont const & f)
// FIXME
}
font_info * fi = fontinfo_[f.family()][f.series()][f.realShape()][f.size()].get();
font_info const * fi = fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
if (!fi) {
fi = new font_info(f);
fontinfo_[f.family()][f.series()][f.realShape()][f.size()].reset(fi);
fontinfo_[f.family()][f.series()][f.realShape()][f.size()] = fi;
}
return fi;

View File

@ -21,8 +21,6 @@
#include <qfont.h>
#include <qfontmetrics.h>
#include <boost/scoped_ptr.hpp>
/**
* Qt font loader for LyX. Matches LyXFonts against
* actual QFont instances, and also caches metrics.
@ -61,7 +59,7 @@ private:
font_info const * getfontinfo(LyXFont const & f);
/// BUTT ugly !
boost::scoped_ptr<font_info> fontinfo_[LyXFont::NUM_FAMILIES][2][4][10];
font_info const * fontinfo_[LyXFont::NUM_FAMILIES][2][4][10];
};
extern qfont_loader fontloader;