summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-12-01 15:32:43 +0100
committerThierry Bastian <thierry.bastian@nokia.com>2009-12-01 16:00:23 +0100
commitce4522cb341340e98427d678664ea84761e3ca07 (patch)
tree8a6ed43c988175da79c0afe8df2a107ed59e4fb0
parenta539ce478800c3dacf8456d206e8fd6dc700ac5c (diff)
downloadqt4-tools-ce4522cb341340e98427d678664ea84761e3ca07.tar.gz
Fixed a potential crash in QDockWidget
This happened when inserting the gap over a place holder item. Task-number: QTBUG-6107 Reviewed-by: Gabi
-rw-r--r--src/gui/widgets/qdockarealayout.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index 497030081b..9422bdc613 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -1167,7 +1167,8 @@ bool QDockAreaLayoutInfo::insertGap(QList<int> path, QLayoutItem *dockWidgetItem
QDockAreaLayoutInfo *subinfo = item.subinfo;
QLayoutItem *widgetItem = item.widgetItem;
- QRect r = subinfo == 0 ? dockedGeometry(widgetItem->widget()) : subinfo->rect;
+ QPlaceHolderItem *placeHolderItem = item.placeHolderItem;
+ QRect r = subinfo == 0 ? widgetItem ? dockedGeometry(widgetItem->widget()) : placeHolderItem->topLevelRect : subinfo->rect;
Qt::Orientation opposite = o == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal;
#ifdef QT_NO_TABBAR
@@ -1176,13 +1177,15 @@ bool QDockAreaLayoutInfo::insertGap(QList<int> path, QLayoutItem *dockWidgetItem
QDockAreaLayoutInfo *new_info
= new QDockAreaLayoutInfo(sep, dockPos, opposite, tabBarShape, mainWindow);
+ //item become a new top-level
item.subinfo = new_info;
item.widgetItem = 0;
+ item.placeHolderItem = 0;
QDockAreaLayoutItem new_item
= widgetItem == 0
? QDockAreaLayoutItem(subinfo)
- : QDockAreaLayoutItem(widgetItem);
+ : widgetItem ? QDockAreaLayoutItem(widgetItem) : QDockAreaLayoutItem(placeHolderItem);
new_item.size = pick(opposite, r.size());
new_item.pos = pick(opposite, r.topLeft());
new_info->item_list.append(new_item);