diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-01 15:57:30 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2010-03-01 16:02:42 (GMT) |
commit | d6910f12cdaac746b0b336cb0d8b9b4ea830e9e2 (patch) | |
tree | 56eb2ecdc48aa96a8096f8d7a7c004725c7ea5f1 /src | |
parent | 65f993d679140fb2dc29b48c9d9d8d2fc5af893d (diff) | |
download | Qt-d6910f12cdaac746b0b336cb0d8b9b4ea830e9e2.zip Qt-d6910f12cdaac746b0b336cb0d8b9b4ea830e9e2.tar.gz Qt-d6910f12cdaac746b0b336cb0d8b9b4ea830e9e2.tar.bz2 |
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')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 4931b46..2faf755 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)); } |