summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qabstractitemview.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-03-01 16:57:30 +0100
committerOlivier Goffart <ogoffart@trolltech.com>2010-03-01 17:02:42 +0100
commitd6910f12cdaac746b0b336cb0d8b9b4ea830e9e2 (patch)
tree56eb2ecdc48aa96a8096f8d7a7c004725c7ea5f1 /src/gui/itemviews/qabstractitemview.cpp
parent65f993d679140fb2dc29b48c9d9d8d2fc5af893d (diff)
Fix crash using openPersistentEditor and setRowHidden on a QTableView
Hiding widget might result in focus changes that will modify the list of editors while iterating over it. Same fixe as in commit 386726f7184cc77f0692e2ba24d85ebc53a39569 The test comes from the Task Task-number: QTBUG-8585 Reviewed-by: Thierry
Diffstat (limited to 'src/gui/itemviews/qabstractitemview.cpp')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 4931b46a50..2faf7558fd 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2568,6 +2568,7 @@ void QAbstractItemView::updateEditorGeometries()
QStyleOptionViewItemV4 option = d->viewOptionsV4();
QList<QEditorInfo>::iterator it = d->editors.begin();
QWidgetList editorsToRelease;
+ QWidgetList editorsToHide;
while (it != d->editors.end()) {
QModelIndex index = it->index;
QWidget *editor = it->editor;
@@ -2579,7 +2580,7 @@ void QAbstractItemView::updateEditorGeometries()
if (delegate)
delegate->updateEditorGeometry(editor, option, index);
} else {
- editor->hide();
+ editorsToHide << editor;
}
++it;
} else {
@@ -2588,8 +2589,11 @@ void QAbstractItemView::updateEditorGeometries()
}
}
- //we release the editor outside of the loop because it might change the focus and try
+ //we hide and release the editor outside of the loop because it might change the focus and try
//to change the d->editors list.
+ for (int i = 0; i < editorsToHide.count(); ++i) {
+ editorsToHide.at(i)->hide();
+ }
for (int i = 0; i < editorsToRelease.count(); ++i) {
d->releaseEditor(editorsToRelease.at(i));
}