Commit dd525dc1 authored by David McAllister's avatar David McAllister Committed by Commit Bot

[Android] Zero out infobar native pointer after destruction

This properly prevents double destruction as intended by the
surrounding if block.

R=mdjones@chromium.org

Bug: None
Change-Id: I97c9d13098bfb01df99a65a55e274ebf1e8d1a07
Reviewed-on: https://chromium-review.googlesource.com/c/1309098Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604375}
parent d4c084e3
......@@ -130,8 +130,10 @@ public class InfoBarContainer extends SwipableOverlayView implements UserData {
WebContents webContents = tab.getWebContents();
if (webContents != null && webContents != getWebContents()) {
setWebContents(webContents);
if (mNativeInfoBarContainer != 0) {
nativeSetWebContents(mNativeInfoBarContainer, webContents);
}
}
mTabView.removeOnAttachStateChangeListener(mAttachedStateListener);
mTabView = tab.getView();
......@@ -170,12 +172,12 @@ public class InfoBarContainer extends SwipableOverlayView implements UserData {
/** Helper class to manage showing in-product help bubbles over specific info bars. */
private final IPHInfoBarSupport mIPHSupport;
/** Native InfoBarContainer pointer which will be set by nativeInit(). */
private final long mNativeInfoBarContainer;
/** The list of all InfoBars in this container, regardless of whether they've been shown yet. */
private final ArrayList<InfoBar> mInfoBars = new ArrayList<InfoBar>();
/** Native InfoBarContainer pointer which will be set by nativeInit(). */
private long mNativeInfoBarContainer;
/** True when this container has been emptied and its native counterpart has been destroyed. */
private boolean mDestroyed;
......@@ -429,6 +431,7 @@ public class InfoBarContainer extends SwipableOverlayView implements UserData {
mDestroyed = true;
if (mNativeInfoBarContainer != 0) {
nativeDestroy(mNativeInfoBarContainer);
mNativeInfoBarContainer = 0;
}
}
......
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