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>
This commit is contained in:
parent
d7e2e943a2
commit
d3ad8cff17
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user