From 9fda26cbc024c5054462a373c2452210801b8942 Mon Sep 17 00:00:00 2001 From: SVN User Date: Tue, 29 Jul 2008 04:35:26 +0000 Subject: [PATCH] fixed crash on exit on windows --- build_num | 2 +- doc/ChangeLog | 7 +++++++ src/gui/ObjectManipulator.cpp | 17 +++++++++-------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/build_num b/build_num index 5a7fe2b4d..faf1199f8 100644 --- a/build_num +++ b/build_num @@ -1 +1 @@ -#define BUILD_NUM 424 +#define BUILD_NUM 426 diff --git a/doc/ChangeLog b/doc/ChangeLog index b0f569722..7d0a5074d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,10 @@ +2008-07-28 + + * ObjectManipulator.cpp (ObjectManipulator::removeLib): fixed + crash that happened upon exit on some platforms. Need to break + away from the loop after lists were modified because iterators + become undefined. + 2008-07-28 Vadim Kurland * New application icon diff --git a/src/gui/ObjectManipulator.cpp b/src/gui/ObjectManipulator.cpp index ca8e429b1..21b177acf 100644 --- a/src/gui/ObjectManipulator.cpp +++ b/src/gui/ObjectManipulator.cpp @@ -654,7 +654,13 @@ void ObjectManipulator::clearObjects() int N = m_objectManipulator->libs->count(); - if (fwbdebug) qDebug("ObjectManipulator::clearObjects %d libs", N); + if (fwbdebug) + { + qDebug("ObjectManipulator::clearObjects %d libs, " + "idxToLibs size: %d, idxToTrees size: %d", N, + int(idxToLibs.size()), + int(idxToTrees.size())); + } for (int i=N-1; i>=0; i--) { @@ -662,17 +668,11 @@ void ObjectManipulator::clearObjects() assert(otv!=NULL); m_objectManipulator->widgetStack->removeWidget( otv ); // delete otv; + removeLib(i); } - - if (fwbdebug) qDebug("ObjectManipulator::clearObjects idxToLibs size: %d", - int(idxToLibs.size())); - if (fwbdebug) qDebug("ObjectManipulator::clearObjects idxToTrees size: %d", - int(idxToTrees.size())); - idxToLibs.clear(); idxToTrees.clear(); - m_objectManipulator->libs->clear(); if (fwbdebug) qDebug("ObjectManipulator::clearObjects done"); @@ -863,6 +863,7 @@ void ObjectManipulator::removeLib(int id) m_objectManipulator->libs->removeItem( idx ); idxToLibs.erase(i1); idxToTrees.erase(i2); + break; } } }