From 5cda0172e0eb912ef4814f3c5618686cbb1a5da1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 16 Mar 2017 10:04:01 +0100 Subject: Fix crash in QWindowPrivate::applyCursor when screen is null QWindow::setVisible calls QWindowPrivate::applyCursor without checking if screen() returns null. This patch adds a check in QWindowPrivate::applyCursor that the screen is not null. Now that it is tested there, no need to test it from the other caller (setCursor) This patch should not change behavior of setCursor at all, it should only fix the crash when coming from setVisible Task-number: QTBUG-59528 Change-Id: I06bbdb4e04c02ac840ba637242d1f2cfde5bdd62 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qwindow.cpp | 17 ++++++++++------- src/gui/kernel/qwindow_p.h | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/gui') diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 94a34b5c27..7ab2d31b86 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -2559,26 +2559,29 @@ void QWindowPrivate::setCursor(const QCursor *newCursor) cursor = QCursor(Qt::ArrowCursor); hasCursor = false; } - // Only attempt to set cursor and emit signal if there is an actual platform cursor - QScreen* screen = q->screen(); - if (screen && screen->handle()->cursor()) { - applyCursor(); + // Only attempt to emit signal if there is an actual platform cursor + if (applyCursor()) { QEvent event(QEvent::CursorChange); QGuiApplication::sendEvent(q, &event); } } -void QWindowPrivate::applyCursor() +// Apply the cursor and returns true iff the platform cursor exists +bool QWindowPrivate::applyCursor() { Q_Q(QWindow); - if (platformWindow) { - if (QPlatformCursor *platformCursor = q->screen()->handle()->cursor()) { + if (QScreen *screen = q->screen()) { + if (QPlatformCursor *platformCursor = screen->handle()->cursor()) { + if (!platformWindow) + return true; QCursor *c = QGuiApplication::overrideCursor(); if (!c && hasCursor) c = &cursor; platformCursor->changeCursor(c, q); + return true; } } + return false; } #endif // QT_NO_CURSOR diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index b8a9f5d3de..c1955be6b6 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -118,7 +118,7 @@ public: void maybeQuitOnLastWindowClosed(); #ifndef QT_NO_CURSOR void setCursor(const QCursor *c = 0); - void applyCursor(); + bool applyCursor(); #endif void deliverUpdateRequest(); -- cgit v1.2.3 From 8f7776df5e649a99377776d4f2b91c220632f36f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 22 Mar 2017 10:06:43 +0100 Subject: QGuiVariant: fix unintended fall-through Found by GCC 7. Change-Id: I8a9cca5236f077335031afc90b2683a2846d3b79 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/gui/kernel/qguivariant.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gui') diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index bde0d20ea8..090217187e 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -291,6 +291,7 @@ static bool convert(const QVariant::Private *d, int t, default: break; } + break; } #endif #ifndef QT_NO_ICON -- cgit v1.2.3 From 87e14eb7cb964467f6dda83dd17668609e68a203 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 6 Mar 2017 20:08:07 +0100 Subject: don't try to use system zlib if it's not enabled ... as that would error out unhelpfully. but hypothetically, there could be dynamic builds of system libpng and sqlite3 against a static zlib, so allow it. however, it's a tad unlikely, so default to -qt-libpng when using -qt-zlib (and -qt-sqlite3 is the default anyway). amends dab013804. Change-Id: I74c41e8d8a7ee1ba5add395842383d176e23f142 Reviewed-by: Lars Knoll Reviewed-by: Joerg Bornemann --- src/gui/configure.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gui') diff --git a/src/gui/configure.json b/src/gui/configure.json index 81fa0db76f..88c9858a34 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -161,7 +161,9 @@ { "libs": "-llibpng", "condition": "config.msvc" }, { "libs": "-lpng", "condition": "!config.msvc" } ], - "use": "zlib" + "use": [ + { "lib": "zlib", "condition": "features.system-zlib" } + ] }, "mirclient": { "label": "Mir client libraries", @@ -667,6 +669,7 @@ "label": " Using system libpng", "disable": "input.libpng == 'qt'", "enable": "input.libpng == 'system'", + "autoDetect": "features.system-zlib", "condition": "features.png && libs.libpng", "output": [ "privateFeature" ] }, -- cgit v1.2.3 From 901ed36f3649fc77e5dc4078c0f0e485732feb7a Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Mon, 27 Feb 2017 14:41:19 +0100 Subject: xbm image format: avoid uninitialized pixels for truncated data xbm bitmaps are conventionally accepted as valid even if there is not enough data to fill the declared bitmap size: both ImageMagick and GIMP do this. Qt did too, but the uncovered areas would be uninitialized, and thus contain random junk bits. This commit adds clearing of the full QImage data. Task-number: QTBUG-54169 Change-Id: I84150d54d07dbd546a4947e7ec332f83f2d7ca41 Reviewed-by: Paul Olav Tvete --- src/gui/image/qxbmhandler.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/gui') diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp index 19015c5dcd..155a4f88b4 100644 --- a/src/gui/image/qxbmhandler.cpp +++ b/src/gui/image/qxbmhandler.cpp @@ -143,6 +143,8 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage) return false; } + outImage->fill(Qt::color0); // in case the image data does not cover the full image + outImage->setColorCount(2); outImage->setColor(0, qRgb(255,255,255)); // white outImage->setColor(1, qRgb(0,0,0)); // black -- cgit v1.2.3