diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-12-27 11:48:26 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-12-31 09:08:59 +0100 |
commit | 4b1d370f755578f60bd9c73ca98eeb8e71463caf (patch) | |
tree | 08aae00b9da9fa15e45105ee52b3547d5e034e3b /src | |
parent | a63969081c2f1656636f6fbc24b402a0f72c410b (diff) |
Check platformNativeInterface pointer before dereferencing
QApplication::platformNativeInterface() returns null if started with
-platform offscreen.
Fixes: QTBUG-80946
Change-Id: I3ad03ad27148c8576bd3fab0b136827bb8d171ae
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qmainwindow.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbarlayout.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 16ed699137..e3dbe763e5 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -1364,6 +1364,8 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set) createWinId(); QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); + if (!nativeInterface) + return; // Not Cocoa platform plugin. QPlatformNativeInterface::NativeResourceForIntegrationFunction function = nativeInterface->nativeResourceFunctionForIntegration("setContentBorderEnabled"); if (!function) diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp index 961a261e8f..92094a38fb 100644 --- a/src/widgets/widgets/qtoolbarlayout.cpp +++ b/src/widgets/widgets/qtoolbarlayout.cpp @@ -360,6 +360,8 @@ void QToolBarLayout::updateMacBorderMetrics() return; QPlatformNativeInterface *nativeInterface = QApplication::platformNativeInterface(); + if (!nativeInterface) + return; // Not Cocoa platform plugin. QPlatformNativeInterface::NativeResourceForIntegrationFunction function = nativeInterface->nativeResourceFunctionForIntegration("registerContentBorderArea"); if (!function) |