Skip to content

Commit

Permalink
Correctly release SendTabDialog in onDestroy (#2928)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Mar 6, 2020
1 parent 9688e63 commit f48ca97
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,13 @@ public void releaseWidget() {
}

detachFromWindow();

mAttachedWindow = null;

if (mSendTabDialog != null && !mSendTabDialog.isReleased()) {
mSendTabDialog.releaseWidget();
}
mSendTabDialog = null;

super.releaseWidget();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ public void attachToWindow(WindowWidget aWindow) {

@Override
public void releaseWidget() {
if (mSendTabDialog != null && !mSendTabDialog.isReleased()) {
mSendTabDialog.releaseWidget();
}
mSendTabDialog = null;
super.releaseWidget();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ public void onResume() {
}

public void onDestroy() {
if (mTabsWidget != null && !mTabsWidget.isReleased()) {
mTabsWidget.releaseWidget();
mTabsWidget = null;
}
mDelegate = null;
for (WindowWidget window: mRegularWindows) {
window.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ private void initialize() {

@Override
public void releaseWidget() {
mWidgetManager.removeWorldClickListener(this);
if (mWidgetManager != null) {
mWidgetManager.removeWorldClickListener(this);
}
mDialogs.remove(this);
super.releaseWidget();
}
Expand Down

0 comments on commit f48ca97

Please sign in to comment.