From 2b7edd053404f4819abf0203bb9c762799849638 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Fri, 3 May 2019 15:47:57 +0200 Subject: Fix bug with QLayout::replaceWidget(a, a) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It should effectively leave the layout untouched Fixes: QTBUG-69706 Change-Id: I4d8232895bf1d1ae0d1b73156ef6ec6001d8968a Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/kernel/qlayout.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/widgets/kernel/qlayout.cpp') 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; -- cgit v1.2.3