diff options
author | Paul Olav Tvete <paul.tvete@digia.com> | 2013-09-17 10:36:57 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-20 12:04:08 +0200 |
commit | 61e0534aff440809f3388245f36e482c22912832 (patch) | |
tree | f8903ae1e20f5ac3582013833dd4199b5b202bd1 /src/widgets/kernel | |
parent | 85708e7377e819649fd17948a77e8a3d6077a4e8 (diff) |
Fix QGLWidget segfault on Android
...and other platforms that do not support WA_NativeWindow.
Task-number: QTBUG-33523
Change-Id: I4ab043e8b3c3369aec41b44275fb3099d90e55b4
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 10 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index eea44300e8..76c4cbcb97 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -269,6 +269,7 @@ QWidgetPrivate::QWidgetPrivate(int version) , isScrolled(0) , isMoved(0) , usesDoubleBufferedGLContext(0) + , mustHaveWindowHandle(0) #ifndef QT_NO_IM , inheritsInputMethodHints(0) #endif @@ -1148,9 +1149,10 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) data.in_destructor = false; // Widgets with Qt::MSWindowsOwnDC (typically QGLWidget) must have a window handle. - if (f & Qt::MSWindowsOwnDC) + if (f & Qt::MSWindowsOwnDC) { + mustHaveWindowHandle = 1; q->setAttribute(Qt::WA_NativeWindow); - + } //#ifdef Q_WS_MAC // q->setAttribute(Qt::WA_NativeWindow); //#endif @@ -10072,8 +10074,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) } #endif - // Don't set WA_NativeWindow on platforms that don't support it - if (attribute == Qt::WA_NativeWindow) { + // Don't set WA_NativeWindow on platforms that don't support it -- except for QGLWidget, which depends on it + if (attribute == Qt::WA_NativeWindow && !d->mustHaveWindowHandle) { QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration(); if (!platformIntegration->hasCapability(QPlatformIntegration::NativeWidgets)) return; diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index 0580f72e11..88aff2b65d 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -693,6 +693,7 @@ public: uint isScrolled : 1; uint isMoved : 1; uint usesDoubleBufferedGLContext : 1; + uint mustHaveWindowHandle : 1; #ifndef QT_NO_IM uint inheritsInputMethodHints : 1; #endif |