Commit 4c8da33a authored by Dominick Ng's avatar Dominick Ng Committed by Commit Bot

Zero-check the AppBannerInfoBarDelegateAndroid native pointer.

There are a number of crashes which seem to come from the Java-side
AppBannerInfoBarDelegateAndroid#OnInstall method calling the native-side
method after its AppBannerUiDelegate object has been cleared. The crash
manifests as a segmentation fault when accessing a std::unique_ptr
member.

This CL zero-checks the native pointer in the Java-side
AppBannerInfoBarDelegateAndroid prior to calling to native.
https://crrev.com/c/959409 attempted to address the crashes by reordering
the destruction procedure of AppBannerInfoBarDelegateAndroid, but this
did not catch all of the crashes.

BUG=819434

Change-Id: Ibb5dbe322ab705173bba3835702fdd27b0e2adcc
Reviewed-on: https://chromium-review.googlesource.com/991312Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Dominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547876}
parent 59497f7b
...@@ -23,17 +23,17 @@ public class AppBannerInfoBarDelegateAndroid implements InstallerDelegate.Observ ...@@ -23,17 +23,17 @@ public class AppBannerInfoBarDelegateAndroid implements InstallerDelegate.Observ
@Override @Override
public void onInstallIntentCompleted(InstallerDelegate delegate, boolean isInstalling) { public void onInstallIntentCompleted(InstallerDelegate delegate, boolean isInstalling) {
nativeOnInstallIntentReturned(mNativePointer, isInstalling); if (mNativePointer != 0) nativeOnInstallIntentReturned(mNativePointer, isInstalling);
} }
@Override @Override
public void onInstallFinished(InstallerDelegate delegate, boolean success) { public void onInstallFinished(InstallerDelegate delegate, boolean success) {
nativeOnInstallFinished(mNativePointer, success); if (mNativePointer != 0) nativeOnInstallFinished(mNativePointer, success);
} }
@Override @Override
public void onApplicationStateChanged(InstallerDelegate delegate, int newState) { public void onApplicationStateChanged(InstallerDelegate delegate, int newState) {
nativeUpdateInstallState(mNativePointer); if (mNativePointer != 0) nativeUpdateInstallState(mNativePointer);
} }
@CalledByNative @CalledByNative
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment