From 9137691e745039f8ad9cdee2594a958e244ba341 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 5 Nov 2018 10:18:50 +0100 Subject: Windows QPA: Fix crash showing QSystemTrayIcon's context menu with PROCESS_DPI_UNAWARE The coordinates of the WM_CONTEXT message may be out of any screen in PROCESS_DPI_UNAWARE mode since hi-res coordinates are delivered in this case (Windows issue). Default to primary screen with check to prevent a crash. Fixes: QTBUG-67966 Change-Id: I1950360520e93cbf3509611b3057635769f6543a Reviewed-by: Andre de la Rocha --- .../platforms/windows/qwindowssystemtrayicon.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp index 901d132ea5..3c27f2914d 100644 --- a/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp +++ b/src/plugins/platforms/windows/qwindowssystemtrayicon.cpp @@ -382,12 +382,20 @@ bool QWindowsSystemTrayIcon::winEvent(const MSG &message, long *result) emit activated(DoubleClick); // release we must ignore it break; case WM_CONTEXTMENU: { + // QTBUG-67966: Coordinates may be out of any screen in PROCESS_DPI_UNAWARE mode + // since hi-res coordinates are delivered in this case (Windows issue). + // Default to primary screen with check to prevent a crash. const QPoint globalPos = QPoint(GET_X_LPARAM(message.wParam), GET_Y_LPARAM(message.wParam)); - const QPlatformScreen *screen = QWindowsContext::instance()->screenManager().screenAtDp(globalPos); - emit contextMenuRequested(globalPos, screen); - emit activated(Context); - if (m_menu) - m_menu->trackPopupMenu(message.hwnd, globalPos.x(), globalPos.y()); + const auto &screenManager = QWindowsContext::instance()->screenManager(); + const QPlatformScreen *screen = screenManager.screenAtDp(globalPos); + if (!screen) + screen = screenManager.screens().value(0); + if (screen) { + emit contextMenuRequested(globalPos, screen); + emit activated(Context); + if (m_menu) + m_menu->trackPopupMenu(message.hwnd, globalPos.x(), globalPos.y()); + } } break; case NIN_BALLOONUSERCLICK: -- cgit v1.2.3 From 7f6497e623fd66e0dc1ecab89ef16533154a6472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 15 Nov 2018 22:26:55 +0100 Subject: Ensure QOpenGLWidget FBO is always initialized QOpenGLWidget uses an FBO internally, that is glCleared whenever recreated. But for the clear to be visible across shared contexts we must also issue a glFlush. QOpenGLWidget defers this flush until the compositing step, in QOpenGLWidgetPrivate::beginCompose(), based on a flushPending variable. This variable is set either after invoking the user's paintGL() function, or when opening a QPainter on the QOpenGLWidget, via QOpenGLWidgetPaintDevice::ensureActiveTarget(). Unfortunately, if QOpenGLWidget::paintEvent() is overridden or intercepted (meaning we will not end up calling paintGL()), but the overridden paint event does not open a QPainter, we end up never setting flushPending to true, and end up composing an uninitialized FBO. This can lead to rendering issues, or even kernel panics with some unfortunate GL drivers. The fix is to ensure the glClear is always flushed before composing, by forcing a pending flush whenever the FBO is recreated. Fixes: QTBUG-70921 Change-Id: I72b596c09dcf54bd0f37668062daaad2d6f7f4bd Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qopenglwidget.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index c96b6812c4..53dc88bd2c 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -756,6 +756,7 @@ void QOpenGLWidgetPrivate::recreateFbo() fbo->bind(); context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + flushPending = true; // Make sure the FBO is initialized before use paintDevice->setSize(deviceSize); paintDevice->setDevicePixelRatio(q->devicePixelRatioF()); -- cgit v1.2.3 From 2a494875b8f3d50046d35fb21988c288fcfa1dc7 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 28 Nov 2018 19:20:52 +0100 Subject: OpenSSL: also try the "1.0.2" soname MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turns out that also Debian patches OpenSSL 1.0, changing its soname to "1.0.2". Therefore, try also to load that one. Amends 2708c6c11d685ab25c12d558961d924c9a4533d2. Task-number: QTBUG-68156 Change-Id: I37cc060e90422779a6c29a324ab900f0fb99cfa7 Reviewed-by: Lisandro Damián Nicanor Pérez Meyer Reviewed-by: Timur Pocheptsov --- src/network/ssl/qsslsocket_openssl_symbols.cpp | 27 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 59c93677dd..2f8095cd81 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -771,7 +771,7 @@ static QPair loadOpenSsl() // reason, we will search a few common paths (see findAllLibSsl() above) in hopes // we find one that works. // - // If that fails, for OpenSSL 1.0 we also try a fallback -- just look up + // If that fails, for OpenSSL 1.0 we also try some fallbacks -- look up // libssl.so with a hardcoded soname. The reason is QTBUG-68156: the binary // builds of Qt happen (at the time of this writing) on RHEL machines, // which change SHLIB_VERSION_NUMBER to a non-portable string. When running @@ -804,14 +804,23 @@ static QPair loadOpenSsl() } #if !QT_CONFIG(opensslv11) - // first-and-half attempt: for OpenSSL 1.0 try to load an hardcoded soname. - libssl->setFileNameAndVersion(QLatin1String("ssl"), QLatin1String("1.0.0")); - libcrypto->setFileNameAndVersion(QLatin1String("crypto"), QLatin1String("1.0.0")); - if (libcrypto->load() && libssl->load()) { - return pair; - } else { - libssl->unload(); - libcrypto->unload(); + // first-and-half attempts: for OpenSSL 1.0 try to load some hardcoded sonames: + // - "1.0.0" is the official upstream one + // - "1.0.2" is found on some distributions (e.g. Debian) that patch OpenSSL + static const QLatin1String fallbackSonames[] = { + QLatin1String("1.0.0"), + QLatin1String("1.0.2") + }; + + for (auto fallbackSoname : fallbackSonames) { + libssl->setFileNameAndVersion(QLatin1String("ssl"), fallbackSoname); + libcrypto->setFileNameAndVersion(QLatin1String("crypto"), fallbackSoname); + if (libcrypto->load() && libssl->load()) { + return pair; + } else { + libssl->unload(); + libcrypto->unload(); + } } #endif #endif -- cgit v1.2.3