diff --git a/src/frontends/qt4/TocModel.C b/src/frontends/qt4/TocModel.C index 570631cf2a..1acafb2bac 100644 --- a/src/frontends/qt4/TocModel.C +++ b/src/frontends/qt4/TocModel.C @@ -96,7 +96,11 @@ void TocModel::populate(TocBackend::Toc const & toc) top_level_item = QStandardItemModel::index(current_row, 0); //setData(top_level_item, toqstr(iter->str())); 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; lyxerr[Debug::GUI] @@ -144,7 +148,11 @@ void TocModel::populate(TocIterator & iter, child_item = QStandardItemModel::index(current_row, 0, parent); //setData(child_item, toqstr(iter->str())); 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; populate(iter, end, child_item); } diff --git a/src/frontends/qt4/TocModel.h b/src/frontends/qt4/TocModel.h index 8a97aebff7..4d36213d72 100644 --- a/src/frontends/qt4/TocModel.h +++ b/src/frontends/qt4/TocModel.h @@ -55,6 +55,8 @@ private: /// typedef std::map TocMap; /// + typedef std::pair TocPair; + /// typedef std::map ModelMap; /// TocMap toc_map_;