Fix for bug 2975 (http://bugzilla.lyx.org/show_bug.cgi?id=2975) from Ozgur Ugras BARAN. Looks like a gcc bug with STL map.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15821 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-11-09 13:13:28 +00:00
parent f27065f936
commit c0f6f79cb0
2 changed files with 12 additions and 2 deletions

View File

@ -96,7 +96,11 @@ void TocModel::populate(TocBackend::Toc const & toc)
top_level_item = QStandardItemModel::index(current_row, 0); top_level_item = QStandardItemModel::index(current_row, 0);
//setData(top_level_item, toqstr(iter->str())); //setData(top_level_item, toqstr(iter->str()));
setData(top_level_item, toqstr(iter->str()), Qt::DisplayRole); setData(top_level_item, toqstr(iter->str()), Qt::DisplayRole);
toc_map_[top_level_item] = iter;
// This looks like a gcc bug, in principle this should work:
//toc_map_[top_level_item] = iter;
// but it crashes with gcc-4.1 and 4.0.2
toc_map_.insert( TocPair(top_level_item, iter) );
model_map_[iter] = top_level_item; model_map_[iter] = top_level_item;
lyxerr[Debug::GUI] lyxerr[Debug::GUI]
@ -144,7 +148,11 @@ void TocModel::populate(TocIterator & iter,
child_item = QStandardItemModel::index(current_row, 0, parent); child_item = QStandardItemModel::index(current_row, 0, parent);
//setData(child_item, toqstr(iter->str())); //setData(child_item, toqstr(iter->str()));
setData(child_item, toqstr(iter->str()), Qt::DisplayRole); setData(child_item, toqstr(iter->str()), Qt::DisplayRole);
toc_map_[child_item] = iter;
// This looks like a gcc bug, in principle this should work:
//toc_map_[child_item] = iter;
// but it crashes with gcc-4.1 and 4.0.2
toc_map_.insert( TocPair(child_item, iter) );
model_map_[iter] = child_item; model_map_[iter] = child_item;
populate(iter, end, child_item); populate(iter, end, child_item);
} }

View File

@ -55,6 +55,8 @@ private:
/// ///
typedef std::map<QModelIndex, TocIterator> TocMap; typedef std::map<QModelIndex, TocIterator> TocMap;
/// ///
typedef std::pair<QModelIndex, TocIterator> TocPair;
///
typedef std::map<TocIterator, QModelIndex> ModelMap; typedef std::map<TocIterator, QModelIndex> ModelMap;
/// ///
TocMap toc_map_; TocMap toc_map_;