Android: don't recreate surface on shutdown

When we suspend the app, we destroy the surface to save resources.
We don't want to create it again just as we are shutting down.

Task-number: QTBUG-41072
Change-Id: I7a616249bee869b92716d0911201a80d73c2f8da
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
bb10
Paul Olav Tvete 2014-09-02 09:42:31 +02:00
parent 9c4c044338
commit d98df9e929
2 changed files with 5 additions and 0 deletions

View File

@ -73,6 +73,7 @@ class QAndroidEventDispatcherStopper
{
public:
static QAndroidEventDispatcherStopper *instance();
static bool stopped() {return !instance()->started; }
void startAll();
void stopAll();
void addEventDispatcher(QAndroidEventDispatcher *dispatcher);

View File

@ -44,6 +44,7 @@
#include "qandroidplatformscreen.h"
#include "androidjnimain.h"
#include "qandroideventdispatcher.h"
#include <QSurfaceFormat>
#include <QtGui/private/qwindow_p.h>
@ -121,6 +122,9 @@ void QAndroidPlatformOpenGLWindow::setGeometry(const QRect &rect)
EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config)
{
if (QAndroidEventDispatcherStopper::stopped())
return m_eglSurface;
QMutexLocker lock(&m_surfaceMutex);
if (m_nativeSurfaceId == -1) {