summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-03-28 08:12:05 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-29 21:22:38 +0100
commit51d4eb8f5ba769cd50457b2f479acc3f30b9f78f (patch)
tree9047ebed8b67736b94f206e6023084420da819eb /src/gui/kernel
parentc5805acccda4b3762bfd4d23ee6622053bb7104d (diff)
If no screens, attempting to create a window results in clean exit
Asserting is only relevant for debug builds, and there were a couple of other places that a segfault would typically occur before the assert had a chance. Change-Id: I1abc82eb3ecfa91050117fab1525f4cbd82ff486 Task-number: QTBUG-37876 Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qwindow.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index fd9e0ad61b..13da58e391 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -159,10 +159,6 @@ QWindow::QWindow(QScreen *targetScreen)
d->screen = targetScreen;
if (!d->screen)
d->screen = QGuiApplication::primaryScreen();
-
- //if your applications aborts here, then chances are your creating a QWindow before the
- //screen list is populated.
- Q_ASSERT(d->screen);
d->init();
}
@@ -232,6 +228,13 @@ QWindow::~QWindow()
void QWindowPrivate::init()
{
Q_Q(QWindow);
+
+ // If your application aborts here, you are probably creating a QWindow
+ // before the screen list is populated.
+ if (!screen) {
+ qFatal("Cannot create window: no screens available");
+ exit(1);
+ }
QObject::connect(screen, SIGNAL(destroyed(QObject*)), q, SLOT(screenDestroyed(QObject*)));
QGuiApplicationPrivate::window_list.prepend(q);
}