Skip to content

Commit 9c9b0cf

Browse files
author
Maciek
committed
Description: When making async calls, we are getting a memory leak. This change fixes this memory leak.
1 parent 2e84d37 commit 9c9b0cf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/methodCallBaton.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ v8::Handle<v8::Value> MethodCallBaton::runSync() {
6464
// called by NanAsyncWorker. This will be on a worker thread
6565
void MethodCallBaton::Execute() {
6666
JNIEnv* env = javaGetEnv(this->m_java->getJvm(), this->m_java->getClassLoader());
67+
JavaScope javaScope(env);
6768
ExecuteInternal(env);
6869
}
6970

@@ -73,6 +74,7 @@ void MethodCallBaton::WorkComplete() {
7374

7475
if(callback) {
7576
JNIEnv* env = javaGetEnv(this->m_java->getJvm(), this->m_java->getClassLoader());
77+
JavaScope javaScope(env);
7678
v8::Handle<v8::Value> result = resultsToV8(env);
7779
if (result->IsNativeError()) {
7880
v8::Handle<v8::Value> argv[] = {

0 commit comments

Comments
 (0)