Skip to content

Commit ce4522c

Browse files
author
Thierry Bastian
committed
Fixed a potential crash in QDockWidget
This happened when inserting the gap over a place holder item. Task-number: QTBUG-6107 Reviewed-by: Gabi
1 parent a539ce4 commit ce4522c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/gui/widgets/qdockarealayout.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,8 @@ bool QDockAreaLayoutInfo::insertGap(QList<int> path, QLayoutItem *dockWidgetItem
11671167

11681168
QDockAreaLayoutInfo *subinfo = item.subinfo;
11691169
QLayoutItem *widgetItem = item.widgetItem;
1170-
QRect r = subinfo == 0 ? dockedGeometry(widgetItem->widget()) : subinfo->rect;
1170+
QPlaceHolderItem *placeHolderItem = item.placeHolderItem;
1171+
QRect r = subinfo == 0 ? widgetItem ? dockedGeometry(widgetItem->widget()) : placeHolderItem->topLevelRect : subinfo->rect;
11711172

11721173
Qt::Orientation opposite = o == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal;
11731174
#ifdef QT_NO_TABBAR
@@ -1176,13 +1177,15 @@ bool QDockAreaLayoutInfo::insertGap(QList<int> path, QLayoutItem *dockWidgetItem
11761177
QDockAreaLayoutInfo *new_info
11771178
= new QDockAreaLayoutInfo(sep, dockPos, opposite, tabBarShape, mainWindow);
11781179

1180+
//item become a new top-level
11791181
item.subinfo = new_info;
11801182
item.widgetItem = 0;
1183+
item.placeHolderItem = 0;
11811184

11821185
QDockAreaLayoutItem new_item
11831186
= widgetItem == 0
11841187
? QDockAreaLayoutItem(subinfo)
1185-
: QDockAreaLayoutItem(widgetItem);
1188+
: widgetItem ? QDockAreaLayoutItem(widgetItem) : QDockAreaLayoutItem(placeHolderItem);
11861189
new_item.size = pick(opposite, r.size());
11871190
new_item.pos = pick(opposite, r.topLeft());
11881191
new_info->item_list.append(new_item);

0 commit comments

Comments
 (0)