Bug 834414 - Destroy the SiteIdentityPopup when the activity is destroyed to prevent leaking the activity. r=margaret

This commit is contained in:
Kartikaya Gupta 2013-01-25 13:51:41 -05:00
parent 9754ce36f2
commit c788ffe1ee
2 changed files with 10 additions and 4 deletions

View File

@ -2280,6 +2280,7 @@ abstract public class GeckoApp
mPromptService.destroy();
if (mTextSelection != null)
mTextSelection.destroy();
SiteIdentityPopup.clearInstance();
Tabs.getInstance().detachFromActivity(this);

View File

@ -29,6 +29,8 @@ public class SiteIdentityPopup extends PopupWindow {
public static final String VERIFIED = "verified";
public static final String IDENTIFIED = "identified";
private static SiteIdentityPopup sInstance;
private Resources mResources;
private boolean mInflated;
@ -48,12 +50,15 @@ public class SiteIdentityPopup extends PopupWindow {
mInflated = false;
}
private static class InstanceHolder {
private static final SiteIdentityPopup INSTANCE = new SiteIdentityPopup();
public static synchronized SiteIdentityPopup getInstance() {
if (sInstance == null) {
sInstance = new SiteIdentityPopup();
}
return sInstance;
}
public static SiteIdentityPopup getInstance() {
return SiteIdentityPopup.InstanceHolder.INSTANCE;
public static synchronized void clearInstance() {
sInstance = null;
}
private void init() {