diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-12-01 14:32:43 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-12-01 15:00:23 (GMT) |
commit | ce4522cb341340e98427d678664ea84761e3ca07 (patch) | |
tree | 8a6ed43c988175da79c0afe8df2a107ed59e4fb0 /src/gui | |
parent | a539ce478800c3dacf8456d206e8fd6dc700ac5c (diff) | |
download | Qt-ce4522cb341340e98427d678664ea84761e3ca07.zip Qt-ce4522cb341340e98427d678664ea84761e3ca07.tar.gz Qt-ce4522cb341340e98427d678664ea84761e3ca07.tar.bz2 |
Fixed a potential crash in QDockWidget
This happened when inserting the gap over a place holder item.
Task-number: QTBUG-6107
Reviewed-by: Gabi
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/qdockarealayout.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 4970300..9422bdc 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); |