Always release surfaces when application is suspended or hidden.

It is needed to recreate surfaces and to redraw when application is
resumed because on some devices when the application is suspended
Android destroys the surfaces.

Change-Id: I8934e94af038b4ecf116d93aea223ad040b0bff1
Task-number: QTBUG-45019
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Sergey Galin <s.galin@2gis.ru>
This commit is contained in:
Saytgalin Alexander 2015-04-01 13:50:16 +06:00 committed by BogDan Vatra
parent d3277bdf02
commit 1bd07b0293
3 changed files with 2 additions and 3 deletions

View File

@ -106,7 +106,6 @@ void QAndroidPlatformForeignWindow::setVisible(bool visible)
void QAndroidPlatformForeignWindow::applicationStateChanged(Qt::ApplicationState state)
{
if (state <= Qt::ApplicationHidden
&& QtAndroid::blockEventLoopsWhenSuspended()
&& m_surfaceId != -1) {
QtAndroid::destroySurface(m_surfaceId);
m_surfaceId = -1;

View File

@ -156,7 +156,7 @@ bool QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config)
void QAndroidPlatformOpenGLWindow::applicationStateChanged(Qt::ApplicationState state)
{
QAndroidPlatformWindow::applicationStateChanged(state);
if (state <= Qt::ApplicationHidden && QtAndroid::blockEventLoopsWhenSuspended()) {
if (state <= Qt::ApplicationHidden) {
lockSurface();
if (m_nativeSurfaceId != -1) {
QtAndroid::destroySurface(m_nativeSurfaceId);

View File

@ -256,7 +256,7 @@ void QAndroidPlatformScreen::applicationStateChanged(Qt::ApplicationState state)
foreach (QAndroidPlatformWindow *w, m_windowStack)
w->applicationStateChanged(state);
if (state <= Qt::ApplicationHidden && QtAndroid::blockEventLoopsWhenSuspended()) {
if (state <= Qt::ApplicationHidden) {
lockSurface();
QtAndroid::destroySurface(m_id);
m_id = -1;