]> git.lyx.org Git - features.git/commitdiff
Fix for bug 2975 (http://bugzilla.lyx.org/show_bug.cgi?id=2975) from Ozgur Ugras...
authorAbdelrazak Younes <younes@lyx.org>
Thu, 9 Nov 2006 13:13:28 +0000 (13:13 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 9 Nov 2006 13:13:28 +0000 (13:13 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15821 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/TocModel.C
src/frontends/qt4/TocModel.h

index 570631cf2ac551cf60680e34d0688add8ac02c88..1acafb2bacfd6c849481e97b7d754fe3d645976a 100644 (file)
@@ -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);
        }
index 8a97aebff7d2d54fe1ad957f052564ca137c6140..4d36213d72a3be97cce3086c21d5d5c084009455 100644 (file)
@@ -55,6 +55,8 @@ private:
        ///
        typedef std::map<QModelIndex, TocIterator> TocMap;
        ///
+       typedef std::pair<QModelIndex, TocIterator> TocPair;
+       ///
        typedef std::map<TocIterator, QModelIndex> ModelMap;
        ///
        TocMap toc_map_;