From: Abdelrazak Younes Date: Thu, 9 Nov 2006 13:13:28 +0000 (+0000) Subject: Fix for bug 2975 (http://bugzilla.lyx.org/show_bug.cgi?id=2975) from Ozgur Ugras... X-Git-Tag: 1.6.10~11965 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=c0f6f79cb0b1b4028706c8cf67c3f345a8aa4f67;p=features.git 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 --- 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_;