Fix bug reported by Helge. Vincent found the problem, really, which was a

pair of uninitialized variables. The reason the crash doesn't happen when 
you open the User Guide is that they get set in TocModel::populate() before 
the slider's maximum value is fixed. It was setting that value to some huge
number that caused the problem.

I've added an assertion to make sure we don't run into this kind of problem
again. Probably not necessary, but it can't hurt.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26356 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-09-11 21:02:18 +00:00
parent 426a9acbf0
commit e2b8ea875d

View File

@ -67,7 +67,8 @@ QModelIndex TocModel::modelIndex(DocIterator const & dit) const
}
TocModel::TocModel(QObject * parent): QStandardItemModel(parent)
TocModel::TocModel(QObject * parent): QStandardItemModel(parent) //,
// maxdepth_(0), mindepth_(0)
{
}
@ -151,7 +152,9 @@ void TocModel::populate(unsigned int & index, QModelIndex const & parent)
int TocModel::modelDepth() const
{
return maxdepth_ - mindepth_;
int const d = maxdepth_ - mindepth_;
LASSERT(d >= 0 && d <= 100, /* */);
return d;
}