Skip to content

Commit

Permalink
[TIMOB-25599] Maintain strong Java reference, let JVM manage our Java…
Browse files Browse the repository at this point in the history
… objects
  • Loading branch information
Gary Mathews committed Dec 12, 2017
1 parent 4ce94c7 commit fd32375
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions android/runtime/v8/src/native/JavaObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void JavaObject::detach()

// V8 says we don't need the object on the JS side
// Let's make the object weak in the JVM now...
MakeJavaWeak();
// MakeJavaWeak();
}

bool JavaObject::isDetached()
Expand Down Expand Up @@ -172,8 +172,9 @@ void JavaObject::MakeJavaStrong()
if (stored == NULL) {
// Sanity check. Did we get into a state where it was weak on Java, got GC'd but the C++ proxy didn't get deleted yet?
LOGE(TAG, "!!! OH NO! We tried to move a weak Java object back to strong, but it's aleady been GC'd by JVM! We're in a bad state! Key: %d", refTableKey_);
} else {
env->DeleteLocalRef(stored);
}
env->DeleteLocalRef(stored);
} else {
// New entry, make sure we have no key, have an object, get a new key
ASSERT(javaObject_ != NULL);
Expand Down

0 comments on commit fd32375

Please sign in to comment.