From d3ad8cff175bd806da126a575025e209277e1514 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 10 Mar 2015 13:40:04 +0100 Subject: Make sure the QDockAreaLayoutInfo item_list is detached when we are going to modify it This can lead to situations in which the gap item ends up in the saved state 'subinfo' is owned by the item, but the const-ness is not transferred to the pointer. So calling a non const function (unplug) that changes the subinfo changes it in the original list as well. This is a problem because that list might be shared with the saved state. Change-Id: I90a5faafea5958043db610a84c069494f2e48137 Reviewed-by: Friedemann Kleint Reviewed-by: Jocelyn Turcotte (Woboq GmbH) --- src/widgets/widgets/qdockarealayout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/widgets/qdockarealayout.cpp') diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp index bc2259ce90..8054c8aa46 100644 --- a/src/widgets/widgets/qdockarealayout.cpp +++ b/src/widgets/widgets/qdockarealayout.cpp @@ -1018,7 +1018,7 @@ QLayoutItem *QDockAreaLayoutInfo::plug(const QList &path) index = -index - 1; if (path.count() > 1) { - const QDockAreaLayoutItem &item = item_list.at(index); + QDockAreaLayoutItem &item = item_list[index]; Q_ASSERT(item.subinfo != 0); return item.subinfo->plug(path.mid(1)); } @@ -1064,7 +1064,7 @@ QLayoutItem *QDockAreaLayoutInfo::unplug(const QList &path) const int index = path.first(); if (path.count() > 1) { - const QDockAreaLayoutItem &item = item_list.at(index); + QDockAreaLayoutItem &item = item_list[index]; Q_ASSERT(item.subinfo != 0); return item.subinfo->unplug(path.mid(1)); } -- cgit v1.2.3