fixed crash that happened when user tried to use context menu item Duplicate

This commit is contained in:
Vadim Kurland
2010-10-04 23:46:33 +00:00
parent cee564ac89
commit 7ccb7a1e38
2 changed files with 5 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
#define BUILD_NUM 3315
#define BUILD_NUM 3316
+4 -6
View File
@@ -403,15 +403,13 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
(getCurrentObjectTree()->getNumSelected()==1 &&
Library::isA(getCurrentObjectTree()->getSelectedObjects().front()));
int libid = 0;
FWObject *cl = getCurrentLib();
vector<FWObject*>::iterator i;
int N = libs_model->rowCount();
for (int i=0 ; i<N; ++i)
for (int row=0 ; row<N; ++row)
{
QModelIndex idx = libs_model->index(i, 0);
QModelIndex idx = libs_model->index(row, 0);
FWObject *lib = libs_model->getLibrary(idx);
if (lib == NULL) continue;
if ( lib->getId()==FWObjectDatabase::STANDARD_LIB_ID ||
@@ -422,7 +420,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
dupID = duptargets->addAction(
tr("place in library %1").arg(
QString::fromUtf8(lib->getName().c_str())));
dupID->setData(libid);
dupID->setData(row);
// can't move to the same library
if (lib == cl) continue; // skip current library
@@ -433,7 +431,7 @@ void ObjectManipulator::contextMenuRequested(const QPoint &pos)
QAction* mact = movetargets->addAction(
tr("to library %1").arg(
QString::fromUtf8(lib->getName().c_str())));
mact->setData(libid);
mact->setData(row);
}
}
}