diff options
author | BogDan Vatra <bogdan@kde.org> | 2014-01-30 17:07:09 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-31 12:07:59 +0100 |
commit | 5096355f0a53d58495f7f8050d3bb3770a203a97 (patch) | |
tree | eabd1d55c21f8049f878cbcad20fa7ee017370e2 /src/plugins | |
parent | b86f7c1c8e323e692cb559df938b016adc459473 (diff) |
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>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformopenglwindow.cpp | 13 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidplatformopenglwindow.h | 3 |
2 files changed, 5 insertions, 11 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp index 86d8bf9d1b..9df6610a99 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.cpp @@ -95,7 +95,7 @@ EGLSurface QAndroidPlatformOpenGLWindow::eglSurface(EGLConfig config) void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config) { QMutexLocker lock(&m_surfaceMutex); - if (m_nativeSurfaceId == -1 || !m_changedAndroidSurface.isValid()) + if (m_nativeSurfaceId == -1 || !m_androidSurfaceObject.isValid()) return; createEgl(config); @@ -107,14 +107,9 @@ void QAndroidPlatformOpenGLWindow::checkNativeSurface(EGLConfig config) void QAndroidPlatformOpenGLWindow::createEgl(EGLConfig config) { clearEgl(); - m_androidSurface = QJNIObjectPrivate(); - m_androidSurface = m_changedAndroidSurface; - m_changedAndroidSurface = QJNIObjectPrivate(); QJNIEnvironmentPrivate env; - m_nativeWindow = ANativeWindow_fromSurface(env, m_androidSurface.object()); - if (m_nativeWindow) - ANativeWindow_acquire(m_nativeWindow); - + m_nativeWindow = ANativeWindow_fromSurface(env, m_androidSurfaceObject.object()); + m_androidSurfaceObject = QJNIObjectPrivate(); m_eglSurface = eglCreateWindowSurface(m_eglDisplay, config, m_nativeWindow, NULL); if (m_eglSurface == EGL_NO_SURFACE) { EGLint error = eglGetError(); @@ -143,7 +138,7 @@ void QAndroidPlatformOpenGLWindow::surfaceChanged(JNIEnv *jniEnv, jobject surfac Q_UNUSED(w); Q_UNUSED(h); lockSurface(); - m_changedAndroidSurface = surface; + m_androidSurfaceObject = surface; m_surfaceWaitCondition.wakeOne(); unlockSurface(); diff --git a/src/plugins/platforms/android/qandroidplatformopenglwindow.h b/src/plugins/platforms/android/qandroidplatformopenglwindow.h index 820453ab01..7af8b722aa 100644 --- a/src/plugins/platforms/android/qandroidplatformopenglwindow.h +++ b/src/plugins/platforms/android/qandroidplatformopenglwindow.h @@ -74,8 +74,7 @@ private: EGLNativeWindowType m_nativeWindow = nullptr; int m_nativeSurfaceId = -1; - QJNIObjectPrivate m_androidSurface; - QJNIObjectPrivate m_changedAndroidSurface; + QJNIObjectPrivate m_androidSurfaceObject; QWaitCondition m_surfaceWaitCondition; }; |