summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
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);
}