Fix surface leak, cleanup opengl window.
ANativeWindow_fromSurface already acquires the surface, no need to call ANativeWindow_acquire. Remove unused variables. Change-Id: I563573072687927256aef76fab20f645f35778a2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
parent
b86f7c1c8e
commit
5096355f0a
@ -95,7 +95,7 @@ EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config)
|
|||||||
void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config)
|
void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config)
|
||||||
{
|
{
|
||||||
QMutexLocker lock(&m_surfaceMutex);
|
QMutexLocker lock(&m_surfaceMutex);
|
||||||
if (m_nativeSurfaceId == -1 || !m_changedAndroidSurface.isValid())
|
if (m_nativeSurfaceId == -1 || !m_androidSurfaceObject.isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
createEgl(config);
|
createEgl(config);
|
||||||
@ -107,14 +107,9 @@ void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config)
|
|||||||
void QAndroidPlatformOpenGLWindow::createEgl(EGLConfig config)
|
void QAndroidPlatformOpenGLWindow::createEgl(EGLConfig config)
|
||||||
{
|
{
|
||||||
clearEgl();
|
clearEgl();
|
||||||
m_androidSurface = QJNIObjectPrivate();
|
|
||||||
m_androidSurface = m_changedAndroidSurface;
|
|
||||||
m_changedAndroidSurface = QJNIObjectPrivate();
|
|
||||||
QJNIEnvironmentPrivate env;
|
QJNIEnvironmentPrivate env;
|
||||||
m_nativeWindow = ANativeWindow_fromSurface(env, m_androidSurface.object());
|
m_nativeWindow = ANativeWindow_fromSurface(env, m_androidSurfaceObject.object());
|
||||||
if (m_nativeWindow)
|
m_androidSurfaceObject = QJNIObjectPrivate();
|
||||||
ANativeWindow_acquire(m_nativeWindow);
|
|
||||||
|
|
||||||
m_eglSurface = eglCreateWindowSurface(m_eglDisplay, config, m_nativeWindow, NULL);
|
m_eglSurface = eglCreateWindowSurface(m_eglDisplay, config, m_nativeWindow, NULL);
|
||||||
if (m_eglSurface == EGL_NO_SURFACE) {
|
if (m_eglSurface == EGL_NO_SURFACE) {
|
||||||
EGLint error = eglGetError();
|
EGLint error = eglGetError();
|
||||||
@ -143,7 +138,7 @@ void QAndroidPlatformOpenGLWindow::surfaceChanged(JNIEnv *jniEnv, jobject surfac
|
|||||||
Q_UNUSED(w);
|
Q_UNUSED(w);
|
||||||
Q_UNUSED(h);
|
Q_UNUSED(h);
|
||||||
lockSurface();
|
lockSurface();
|
||||||
m_changedAndroidSurface = surface;
|
m_androidSurfaceObject = surface;
|
||||||
m_surfaceWaitCondition.wakeOne();
|
m_surfaceWaitCondition.wakeOne();
|
||||||
unlockSurface();
|
unlockSurface();
|
||||||
|
|
||||||
|
@ -74,8 +74,7 @@ private:
|
|||||||
EGLNativeWindowType m_nativeWindow = nullptr;
|
EGLNativeWindowType m_nativeWindow = nullptr;
|
||||||
|
|
||||||
int m_nativeSurfaceId = -1;
|
int m_nativeSurfaceId = -1;
|
||||||
QJNIObjectPrivate m_androidSurface;
|
QJNIObjectPrivate m_androidSurfaceObject;
|
||||||
QJNIObjectPrivate m_changedAndroidSurface;
|
|
||||||
QWaitCondition m_surfaceWaitCondition;
|
QWaitCondition m_surfaceWaitCondition;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user