diff options
| author | Steve Block <steveblock@google.com> | 2011-05-12 12:48:14 +0100 |
|---|---|---|
| committer | Steve Block <steveblock@google.com> | 2011-06-02 14:08:37 +0100 |
| commit | b4d178df818e8b6e7a1cfbb0e34bbf7bb9d74ec9 (patch) | |
| tree | 85bdbdf9e1873a443a8215103fb09d35bd420b33 /Source/WebCore/plugins | |
| parent | 1b22c7a9c33756726c60ab2c9c67d4bbeac153ce (diff) | |
| download | external_webkit-b4d178df818e8b6e7a1cfbb0e34bbf7bb9d74ec9.zip external_webkit-b4d178df818e8b6e7a1cfbb0e34bbf7bb9d74ec9.tar.gz external_webkit-b4d178df818e8b6e7a1cfbb0e34bbf7bb9d74ec9.tar.bz2 | |
Always check weak global references before using them
We hold weak references to Java objects from native code in several
places to avoid circular reference problems. These objects may become
weakly reachable at any time, after which the GC could null our weak
reference, so we have to null-check at every use.
Note that weak references are nulled before the referent is finalized,
so we can't rely on doing work in the finalizer to wait for the
currently executing message to complete and to remove other messages
from the queue.
This effectively reverts
https://android-git.corp.google.com/g/#change,30955
Bug: 4336862
Change-Id: I431fcac11220cb406c26e31aacb9bda7ea22776e
Diffstat (limited to 'Source/WebCore/plugins')
| -rw-r--r-- | Source/WebCore/plugins/android/PluginViewAndroid.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Source/WebCore/plugins/android/PluginViewAndroid.cpp b/Source/WebCore/plugins/android/PluginViewAndroid.cpp index 6c712d0..8b737ea 100644 --- a/Source/WebCore/plugins/android/PluginViewAndroid.cpp +++ b/Source/WebCore/plugins/android/PluginViewAndroid.cpp @@ -539,6 +539,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re // Return the top level WebView Java object associated // with this instance. jobject *retObject = static_cast<jobject*>(value); + // TODO: Is it safe for this to be NULL? It looks from the NPNVWindowNPObject case that it is. *retObject = android::WebViewCore::getWebViewCore(parent())->getWebViewJavaObject(); *result = NPERR_NO_ERROR; return true; @@ -564,6 +565,7 @@ bool PluginView::platformGetValue(NPNVariable variable, void* value, NPError* re case kJavaContext_ANPGetValue: { jobject* retObject = static_cast<jobject*>(value); + // TODO: Is it safe for this to be NULL? It looks from the NPNVWindowNPObject case that it is. *retObject = android::WebViewCore::getWebViewCore(parent())->getContext(); *result = NPERR_NO_ERROR; return true; |
