a different attempt to clear the MainView in onDestroy(), again to prevent crashing
This commit is contained in:
parent
15c618bc0b
commit
8420c6c961
3 changed files with 9 additions and 17 deletions
|
|
@ -57,7 +57,7 @@ abstract public class MainViewHandler extends HotkeyHandler {
|
|||
orientationListener = null;
|
||||
}
|
||||
if (mainView != null) {
|
||||
mainView.stopListeners();
|
||||
mainView.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -217,9 +217,6 @@ public class TraditionalT9 extends MainViewHandler {
|
|||
requestHideSelf(0);
|
||||
cleanUp();
|
||||
stopSelf();
|
||||
if (mainView != null) {
|
||||
mainView.destroy();
|
||||
}
|
||||
isDead = true;
|
||||
}
|
||||
|
||||
|
|
@ -236,14 +233,14 @@ public class TraditionalT9 extends MainViewHandler {
|
|||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (!isDead) {
|
||||
if (isDead) {
|
||||
Logger.w(LOG_TAG, "===> Already dead. Not destroying self.");
|
||||
return;
|
||||
}
|
||||
|
||||
cleanUp();
|
||||
isDead = true;
|
||||
}
|
||||
super.onDestroy();
|
||||
if (mainView != null) { // this run last because the MainView is used in super.onDestroy()
|
||||
mainView.destroy();
|
||||
}
|
||||
Logger.d(LOG_TAG, "===> Shutdown completed");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,16 +52,11 @@ public class ResizableMainView extends MainView implements View.OnAttachStateCha
|
|||
}
|
||||
|
||||
|
||||
public void stopListeners() {
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (main != null && main.getView() != null) {
|
||||
main.getView().removeOnAttachStateChangeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
stopListeners();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue