QWidget: Don't re-use backing store on Android
QWidget re-uses backing stores created in QWidgetPrivate::create(). The Android platform plugin creates a new platform window, when a widget becomes a toplevel window. When it is hidden, the platform window is deleted. The link between QAndroidPlatformWindow and its backing store is made in the constructor of QAndroidPlatformBackingstore. When a new QAndroidPlatformWindow is constructed and the backing store is re-used, there is no more link between platform window and platform backing store. This has lead to screen assets not being painted, when shown more than once. This patch forces QWidgetPrivate::create() to construct a new backing store on Android. This way, toplevel windows always have a backing store associated with it. It adds an assertion to QAndroidPlatformScreen::addWindow(). That will make e.g. tst_QWidget::visible() crash without the fix. Fixes: QTBUG-97482 Change-Id: Ib1b172068b03549df161ab93ac24a273221d5423 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit dbb072eb2838a04e89e34dad686394a496d5de87) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
c5986c9e59
commit
1781eb50ac
@ -43,7 +43,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
QTime m_timer;
|
||||
QElapsedTimer m_timer;
|
||||
QString m_msg;
|
||||
};
|
||||
|
||||
@ -172,6 +172,7 @@ bool QAndroidPlatformScreen::event(QEvent *event)
|
||||
|
||||
void QAndroidPlatformScreen::addWindow(QAndroidPlatformWindow *window)
|
||||
{
|
||||
Q_ASSERT(window->backingStore());
|
||||
if (window->parent() && window->isRaster())
|
||||
return;
|
||||
|
||||
|
@ -1329,7 +1329,13 @@ void QWidgetPrivate::create()
|
||||
}
|
||||
#endif
|
||||
|
||||
// Android doesn't allow to re-use the backing store.
|
||||
// => force creation of a new one.
|
||||
#ifdef Q_OS_ANDROID
|
||||
QBackingStore *store = nullptr;
|
||||
#else
|
||||
QBackingStore *store = q->backingStore();
|
||||
#endif
|
||||
usesRhiFlush = false;
|
||||
|
||||
// Re-use backing store, in case a new platform window was created and doesn't know about it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user