From 0bbc32a0cb3b71012a9245b84f69cdc8405ce5fc Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 30 Jul 2013 12:06:07 +0200 Subject: Android: Fix crash when setting WA_NativeWindow We don't support native widgets in Android, so we can get into a mess when people set this widget attribute, since the FB compositor will assume that all widgets have their own backing store. This adds a capability flag to the QPlatformIntegration which allows the plugin to disable the WA_NativeWindow feature. Task-number: QTBUG-32685 Change-Id: Ic200487da4a297f71ab594cf7c90d1e1d53bacd3 Reviewed-by: Gunnar Sletta --- src/widgets/kernel/qwidget.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index ac649b4bdf..fcef038e1e 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -10039,6 +10039,13 @@ 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) { + QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration(); + if (!platformIntegration->hasCapability(QPlatformIntegration::NativeWidgets)) + return; + } + setAttribute_internal(attribute, on, data, d); switch (attribute) { -- cgit v1.2.3