mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 755324 - Avoid JNI leak in AndroidGLController::ProvideEGLSurface. r=kats
This commit is contained in:
parent
7d366238f9
commit
33db9b1f0b
@ -36,8 +36,11 @@
|
|||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include "AndroidLayerViewWrapper.h"
|
#include "AndroidLayerViewWrapper.h"
|
||||||
|
#include "AndroidBridge.h"
|
||||||
#include "nsDebug.h"
|
#include "nsDebug.h"
|
||||||
|
|
||||||
|
using namespace mozilla;
|
||||||
|
|
||||||
#define ASSERT_THREAD() \
|
#define ASSERT_THREAD() \
|
||||||
NS_ASSERTION(pthread_self() == mThread, "Something is calling AndroidGLController from the wrong thread!")
|
NS_ASSERTION(pthread_self() == mThread, "Something is calling AndroidGLController from the wrong thread!")
|
||||||
|
|
||||||
@ -77,6 +80,7 @@ void
|
|||||||
AndroidGLController::SetGLVersion(int aVersion)
|
AndroidGLController::SetGLVersion(int aVersion)
|
||||||
{
|
{
|
||||||
ASSERT_THREAD();
|
ASSERT_THREAD();
|
||||||
|
AutoLocalJNIFrame jniFrame(mJEnv, 0);
|
||||||
mJEnv->CallVoidMethod(mJObj, jSetGLVersionMethod, aVersion);
|
mJEnv->CallVoidMethod(mJObj, jSetGLVersionMethod, aVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,6 +88,7 @@ EGLSurface
|
|||||||
AndroidGLController::ProvideEGLSurface()
|
AndroidGLController::ProvideEGLSurface()
|
||||||
{
|
{
|
||||||
ASSERT_THREAD();
|
ASSERT_THREAD();
|
||||||
|
AutoLocalJNIFrame jniFrame(mJEnv);
|
||||||
jobject jObj = mJEnv->CallObjectMethod(mJObj, jProvideEGLSurfaceMethod);
|
jobject jObj = mJEnv->CallObjectMethod(mJObj, jProvideEGLSurfaceMethod);
|
||||||
return reinterpret_cast<EGLSurface>(mJEnv->GetIntField(jObj, jEGLSurfacePointerField));
|
return reinterpret_cast<EGLSurface>(mJEnv->GetIntField(jObj, jEGLSurfacePointerField));
|
||||||
}
|
}
|
||||||
@ -92,5 +97,6 @@ void
|
|||||||
AndroidGLController::WaitForValidSurface()
|
AndroidGLController::WaitForValidSurface()
|
||||||
{
|
{
|
||||||
ASSERT_THREAD();
|
ASSERT_THREAD();
|
||||||
|
AutoLocalJNIFrame jniFrame(mJEnv, 0);
|
||||||
mJEnv->CallVoidMethod(mJObj, jWaitForValidSurfaceMethod);
|
mJEnv->CallVoidMethod(mJObj, jWaitForValidSurfaceMethod);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user