Bug 1298161 - c. Properly remove pref handler in NativePanZoomController; r=rbarker

Properly remove pref handler on destroy to prevent leaking BrowserApp.
This commit is contained in:
Jim Chen 2016-08-30 14:49:38 -04:00
parent 9fe8d04e65
commit e6e2011d34

View File

@ -29,7 +29,7 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
private Overscroll mOverscroll;
boolean mNegateWheelScroll;
private float mPointerScrollFactor;
private final PrefsHelper.PrefHandler mPrefsObserver;
private PrefsHelper.PrefHandler mPrefsObserver;
private long mLastDownTime;
private static final float MAX_SCROLL = 0.075f * GeckoAppShell.getDpi();
@ -197,6 +197,10 @@ class NativePanZoomController extends JNIObject implements PanZoomController {
@Override @WrapForJNI(calledFrom = "ui") // PanZoomController
public void destroy() {
if (mPrefsObserver != null) {
PrefsHelper.removeObserver(mPrefsObserver);
mPrefsObserver = null;
}
if (mDestroyed || !mTarget.isGeckoReady()) {
return;
}