Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 269443003: Safety check has been added before calling native JNI functions to prevent random crashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated code based on review comments. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index 40661f1caf9c7d53fcc92e2032619dec8ccb6767..dd5d22bbef217f6d7be4dac10591f4731982901d 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -1456,8 +1456,10 @@ public class ContentViewCore
TraceEvent.begin();
if (newConfig.keyboard != Configuration.KEYBOARD_NOKEYS) {
- mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore),
- ImeAdapter.getTextInputTypeNone());
+ if (mNativeContentViewCore != 0) {
+ mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore),
+ ImeAdapter.getTextInputTypeNone());
+ }
mInputMethodManagerWrapper.restartInput(mContainerView);
}
mContainerViewInternals.super_onConfigurationChanged(newConfig);
@@ -1641,6 +1643,8 @@ public class ContentViewCore
if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
switch (event.getAction()) {
case MotionEvent.ACTION_SCROLL:
+ if (mNativeContentViewCore == 0) return false;
+
nativeSendMouseWheelEvent(mNativeContentViewCore, event.getEventTime(),
event.getX(), event.getY(),
event.getAxisValue(MotionEvent.AXIS_VSCROLL));
@@ -2116,7 +2120,7 @@ public class ContentViewCore
}
public void clearSslPreferences() {
- nativeClearSslPreferences(mNativeContentViewCore);
+ if (mNativeContentViewCore != 0) nativeClearSslPreferences(mNativeContentViewCore);
}
private boolean isSelectionHandleShowing() {
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698