This patch solves the crash while calling Qt4-TOC dialog in Linux /gcc-4.1

Can somebody commit it?
Index: frontends/qt4/TocModel.C
===================================================================
--- frontends/qt4/TocModel.C	(revision 15811)
+++ frontends/qt4/TocModel.C	(working copy)
@@ -96,7 +96,7 @@
 			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;
+			toc_map_.insert( TocPair(top_level_item, iter) );
 			model_map_[iter] = top_level_item;
 
 			lyxerr[Debug::GUI]
@@ -144,7 +144,7 @@
 		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;
+		toc_map_.insert( TocPair(child_item, iter) );
 		model_map_[iter] = child_item;
 		populate(iter, end, child_item);
 	}
Index: frontends/qt4/TocModel.h
===================================================================
--- frontends/qt4/TocModel.h	(revision 15811)
+++ frontends/qt4/TocModel.h	(working copy)
@@ -55,6 +55,8 @@
 	///
 	typedef std::map<QModelIndex, TocIterator> TocMap;
 	///
+	typedef std::pair<QModelIndex, TocIterator> TocPair;
+	///
 	typedef std::map<TocIterator, QModelIndex> ModelMap;
 	///
 	TocMap toc_map_;

Reply via email to