summaryrefslogtreecommitdiffstats
path: root/src/widgets/util
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2022-03-12 01:48:07 +0100
committerDavid Faure <david.faure@kdab.com>2022-03-13 16:13:29 +0000
commit7382e5735ea734fe5e5777518394963593603c32 (patch)
tree380ca56ad61afa74d00283884387c1305c0e8913 /src/widgets/util
parent2140edaaab0bf61f354db521efca773568becc56 (diff)
QCompleter: fix crash when setting the same model twice
Found when retesting the testcase completer.zip from QTBUG-54642 Pick-to: 6.3 6.2 5.15 Change-Id: Id84eefeb3a33dc6d790cfa23755352381cc097a9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/util')
-rw-r--r--src/widgets/util/qcompleter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index 115af89de2..32d3956847 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1100,6 +1100,8 @@ void QCompleter::setModel(QAbstractItemModel *model)
{
Q_D(QCompleter);
QAbstractItemModel *oldModel = d->proxy->sourceModel();
+ if (oldModel == model)
+ return;
#if QT_CONFIG(filesystemmodel)
if (qobject_cast<const QFileSystemModel *>(oldModel))
setCompletionRole(Qt::EditRole); // QTBUG-54642, clear FileNameRole set by QFileSystemModel