summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-06-22 07:57:38 (GMT)
committerEskil Abrahamsen Blomfeldt <eblomfel@trolltech.com>2009-06-22 08:00:55 (GMT)
commit1a2a6c152dbb467f31bd809098a19f4c90c6d48f (patch)
tree3e5cfa4fb6f11c6c9053942dc922c09ff61a1de0 /tools
parent0a2fa1662cf482736e8c439596d5c057f58e1454 (diff)
downloadQt-1a2a6c152dbb467f31bd809098a19f4c90c6d48f.zip
Qt-1a2a6c152dbb467f31bd809098a19f4c90c6d48f.tar.gz
Qt-1a2a6c152dbb467f31bd809098a19f4c90c6d48f.tar.bz2
Fix crash in widget box when using load mode "LoadCustomWidgetsOnly"
When loading the widget box with load mode "LoadCustomWidgetsOnly", it will create an empty category. This will indirectly cause a resize event to be posted for the tree widget of the widget box, which in turn will cause adjustSubListSize() to be called for each category item in the tree widget. Since the category has not yet been populated, the assumption in adjustSubListSize() that cat_item->child(0) is non-null would cause a crash. The fix is to return immediately if the category is empty. Reviewed-by: Friedemann Kleint
Diffstat (limited to 'tools')
-rw-r--r--tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp b/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp
index 99dfb9c..38e3501 100644
--- a/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp
+++ b/tools/designer/src/components/widgetbox/widgetboxtreewidget.cpp
@@ -664,6 +664,9 @@ WidgetBoxTreeWidget::CategoryList WidgetBoxTreeWidget::loadCustomCategoryList()
void WidgetBoxTreeWidget::adjustSubListSize(QTreeWidgetItem *cat_item)
{
QTreeWidgetItem *embedItem = cat_item->child(0);
+ if (embedItem == 0)
+ return;
+
WidgetBoxCategoryListView *list_widget = static_cast<WidgetBoxCategoryListView*>(itemWidget(embedItem, 0));
list_widget->setFixedWidth(header()->width());
list_widget->doItemsLayout();