summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qlayout.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index e3f6a56875..8ea93f7d4e 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -1156,6 +1156,8 @@ QLayoutItem *QLayout::replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOpt
Q_D(QLayout);
if (!from || !to)
return 0;
+ if (from == to) // Do not return a QLayoutItem for \a from, since ownership still
+ return nullptr; // belongs to the layout (since nothing was changed)
int index = -1;
QLayoutItem *item = 0;