summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorAndy Shaw <qt-info@nokia.com>2010-01-18 09:05:46 (GMT)
committerAndy Shaw <qt-info@nokia.com>2010-01-18 09:05:46 (GMT)
commit7e76201808549c0837d1a5154ed8737fb0296c00 (patch)
treec8e598d84f2967cd3571f06fd3e4db73be8b8386 /src/gui
parenteccddae15a5e675e3b72a72b10457a5e9ea340b7 (diff)
downloadQt-7e76201808549c0837d1a5154ed8737fb0296c00.zip
Qt-7e76201808549c0837d1a5154ed8737fb0296c00.tar.gz
Qt-7e76201808549c0837d1a5154ed8737fb0296c00.tar.bz2
Fixes: When calling QDesktopWidget::screenGeometry() with a null
pointer then it should not crash but warn instead. Task: - RevBy: Andreas AutoTest: Included Details: This also fixes availableGeometry() as well to warn under the same circumstances.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qdesktopwidget.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/kernel/qdesktopwidget.cpp b/src/gui/kernel/qdesktopwidget.cpp
index c8a4373..24b4e57 100644
--- a/src/gui/kernel/qdesktopwidget.cpp
+++ b/src/gui/kernel/qdesktopwidget.cpp
@@ -47,6 +47,11 @@ QT_BEGIN_NAMESPACE
const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const
{
+ if (!widget) {
+ qWarning("QDesktopWidget::screenGeometry(): Attempt "
+ "to get the screen geometry of a null widget");
+ return QRect();
+ }
QRect rect = QWidgetPrivate::screenGeometry(widget);
if (rect.isNull())
return screenGeometry(screenNumber(widget));
@@ -55,6 +60,11 @@ const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const
const QRect QDesktopWidget::availableGeometry(const QWidget *widget) const
{
+ if (!widget) {
+ qWarning("QDesktopWidget::availableGeometry(): Attempt "
+ "to get the available geometry of a null widget");
+ return QRect();
+ }
QRect rect = QWidgetPrivate::screenGeometry(widget);
if (rect.isNull())
return availableGeometry(screenNumber(widget));