From 3995b5e2f95f9af68cadb28f106910259f29ac3b Mon Sep 17 00:00:00 2001 From: stv Date: Tue, 10 Jan 2006 14:23:32 +0000 Subject: [PATCH] If items removed from outside and removed from map then map iterator in destructor become invalid. Copy of map is used. --- src/Qtx/QtxResourceEdit.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Qtx/QtxResourceEdit.cxx b/src/Qtx/QtxResourceEdit.cxx index e1c9e7538..e499236ff 100644 --- a/src/Qtx/QtxResourceEdit.cxx +++ b/src/Qtx/QtxResourceEdit.cxx @@ -35,8 +35,13 @@ QtxResourceEdit::QtxResourceEdit( QtxResourceMgr* mgr ) QtxResourceEdit::~QtxResourceEdit() { + ItemMap items; for ( ItemMap::ConstIterator it = myItems.begin(); it != myItems.end(); ++it ) - delete it.data(); + items.insert( it.key(), it.data() ); + + for ( ItemMap::ConstIterator itr = items.begin(); itr != items.end(); ++itr ) + if ( myItems.contains( itr.key() ) ) + delete itr.data(); } QtxResourceMgr* QtxResourceEdit::resourceMgr() const -- 2.39.2