From 51d4eb8f5ba769cd50457b2f479acc3f30b9f78f Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 28 Mar 2014 08:12:05 +0100 Subject: 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 Reviewed-by: Laszlo Agocs --- src/widgets/util/qcolormap.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/widgets/util/qcolormap.cpp') diff --git a/src/widgets/util/qcolormap.cpp b/src/widgets/util/qcolormap.cpp index 03ee8a395e..decfd7bd2c 100644 --- a/src/widgets/util/qcolormap.cpp +++ b/src/widgets/util/qcolormap.cpp @@ -66,7 +66,12 @@ static QColormapPrivate *screenMap = 0; void QColormap::initialize() { screenMap = new QColormapPrivate; - + if (!QGuiApplication::primaryScreen()) { + qWarning("no screens available, assuming 24-bit color"); + screenMap->depth = 24; + screenMap->mode = QColormap::Direct; + return; + } screenMap->depth = QGuiApplication::primaryScreen()->depth(); if (screenMap->depth < 8) { screenMap->mode = QColormap::Indexed; -- cgit v1.2.3