summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qdockarealayout.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2015-03-10 13:40:04 +0100
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2015-06-16 06:36:05 +0000
commitd3ad8cff175bd806da126a575025e209277e1514 (patch)
tree77c194d730532a2e2b502ffcb9d81bfe19314eeb /src/widgets/widgets/qdockarealayout.cpp
parentd7e2e943a2c10bd7b5113770574a65fd832c34c1 (diff)
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 <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Jocelyn Turcotte (Woboq GmbH) <jturcotte@woboq.com>
Diffstat (limited to 'src/widgets/widgets/qdockarealayout.cpp')
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp4
1 files changed, 2 insertions, 2 deletions
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<int> &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<int> &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));
}