MINGW-packages/mingw-w64-qt5/0048-qt-5.4.2-win32-Avoid-platformNativeInterface-segfaults-with-minimal-platform.patch
2015-11-12 00:16:00 +00:00

76 lines
4.6 KiB
Diff

diff -urN qt-everywhere-opensource-src-5.5.0.orig/qtbase/src/widgets/dialogs/qmessagebox.cpp qt-everywhere-opensource-src-5.5.0/qtbase/src/widgets/dialogs/qmessagebox.cpp
--- qt-everywhere-opensource-src-5.5.0.orig/qtbase/src/widgets/dialogs/qmessagebox.cpp 2015-08-26 14:28:59.145124600 +0100
+++ qt-everywhere-opensource-src-5.5.0/qtbase/src/widgets/dialogs/qmessagebox.cpp 2015-08-26 15:46:50.092516900 +0100
@@ -68,9 +68,11 @@
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
HMENU qt_getWindowsSystemMenu(const QWidget *w)
{
- if (QWindow *window = QApplicationPrivate::windowForWidget(w))
- if (void *handle = QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window))
- return GetSystemMenu(reinterpret_cast<HWND>(handle), false);
+ if (QGuiApplication::platformNativeInterface()) {
+ if (QWindow *window = QApplicationPrivate::windowForWidget(w))
+ if (void *handle = QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window))
+ return GetSystemMenu(reinterpret_cast<HWND>(handle), false);
+ }
return 0;
}
#endif
diff -urN qt-everywhere-opensource-src-5.5.0.orig/qtbase/src/widgets/dialogs/qwizard_win.cpp qt-everywhere-opensource-src-5.5.0/qtbase/src/widgets/dialogs/qwizard_win.cpp
--- qt-everywhere-opensource-src-5.5.0.orig/qtbase/src/widgets/dialogs/qwizard_win.cpp 2015-08-26 14:28:59.139624600 +0100
+++ qt-everywhere-opensource-src-5.5.0/qtbase/src/widgets/dialogs/qwizard_win.cpp 2015-08-26 15:46:50.084516900 +0100
@@ -288,10 +288,11 @@
// The dynamic property takes effect when creating the platform window.
window->setProperty("_q_windowsCustomMargins", customMarginsV);
// If a platform window exists, change via native interface.
- if (QPlatformWindow *platformWindow = window->handle()) {
- QGuiApplication::platformNativeInterface()->
- setWindowProperty(platformWindow, QStringLiteral("WindowsCustomMargins"),
- customMarginsV);
+ if (QGuiApplication::platformNativeInterface()) {
+ if (QPlatformWindow *platformWindow = window->handle())
+ QGuiApplication::platformNativeInterface()->
+ setWindowProperty(platformWindow, QStringLiteral("WindowsCustomMargins"),
+ customMarginsV);
}
}
}
@@ -685,6 +686,8 @@
// wizard is a child window.
HDC QVistaHelper::backingStoreDC(const QWidget *wizard, QPoint *offset)
{
+ if (!QGuiApplication::platformNativeInterface())
+ return static_cast<HDC>(0);
HDC hdc = static_cast<HDC>(QGuiApplication::platformNativeInterface()->nativeResourceForBackingStore(QByteArrayLiteral("getDC"), wizard->backingStore()));
*offset = QPoint(0, 0);
if (!wizard->windowHandle())
@@ -699,7 +702,7 @@
// Do not use winId() as this enforces native children of the parent
// widget when called before show() as happens when calling setWizardStyle().
if (QWindow *window = wizard->windowHandle())
- if (window->handle())
+ if (window->handle() && QGuiApplication::platformNativeInterface())
if (void *vHwnd = QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("handle"), window))
return static_cast<HWND>(vHwnd);
qWarning().nospace() << "Failed to obtain HWND for wizard.";
diff -urN qt-everywhere-opensource-src-5.5.0.orig/qtbase/src/widgets/kernel/qapplication_p.h qt-everywhere-opensource-src-5.5.0/qtbase/src/widgets/kernel/qapplication_p.h
--- qt-everywhere-opensource-src-5.5.0.orig/qtbase/src/widgets/kernel/qapplication_p.h 2015-08-26 14:28:59.349124600 +0100
+++ qt-everywhere-opensource-src-5.5.0/qtbase/src/widgets/kernel/qapplication_p.h 2015-08-26 15:46:50.098516900 +0100
@@ -254,10 +254,12 @@
#ifdef Q_OS_WIN
static HWND getHWNDForWidget(const QWidget *widget)
{
- if (QWindow *window = windowForWidget(widget))
- if (window->handle())
- return static_cast<HWND> (QGuiApplication::platformNativeInterface()->
- nativeResourceForWindow(QByteArrayLiteral("handle"), window));
+ if (QGuiApplication::platformNativeInterface()) {
+ if (QWindow *window = windowForWidget(widget))
+ if (window->handle())
+ return static_cast<HWND> (QGuiApplication::platformNativeInterface()->
+ nativeResourceForWindow(QByteArrayLiteral("handle"), window));
+ }
return 0;
}
#endif