From 6462303c56349045ce4a9517a7882215b2da929e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 11 Nov 2009 17:58:45 +0100 Subject: fix crash in QWidgetPrivate::screenGeometry Missing null check added. Not really a Windows CE only crash. The following code crashed on all platforms, because the QGraphicsProxyWidget had no scene yet. QPushButton *button = new QPushButton; QGraphicsProxyWidget *buttonProxy = new QGraphicsProxyWidget; buttonProxy->setWidget(button); qApp->desktop()->screenGeometry(button); Task-number: QTBUG-5626 Reviewed-by: Alessandro Portale --- src/gui/kernel/qwidget_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index df28bac..eea929b 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -479,7 +479,7 @@ public: QGraphicsProxyWidget *ancestorProxy = widget->d_func()->nearestGraphicsProxyWidget(widget); //It's embedded if it has an ancestor if (ancestorProxy) { - if (!bypassGraphicsProxyWidget(widget)) { + if (!bypassGraphicsProxyWidget(widget) && ancestorProxy->scene() != 0) { // One view, let be smart and return the viewport rect then the popup is aligned if (ancestorProxy->scene()->views().size() == 1) { QGraphicsView *view = ancestorProxy->scene()->views().at(0); -- cgit v0.12