when shutting down, the MainView is now destroyed last, to prevent crashes; also destroyed on start, just in case
This commit is contained in:
parent
3f1330f152
commit
6139517d75
4 changed files with 16 additions and 3 deletions
|
|
@ -57,7 +57,7 @@ abstract public class MainViewHandler extends HotkeyHandler {
|
|||
orientationListener = null;
|
||||
}
|
||||
if (mainView != null) {
|
||||
mainView.destroy();
|
||||
mainView.stopListeners();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -217,6 +217,9 @@ public class TraditionalT9 extends MainViewHandler {
|
|||
requestHideSelf(0);
|
||||
cleanUp();
|
||||
stopSelf();
|
||||
if (mainView != null) {
|
||||
mainView.destroy();
|
||||
}
|
||||
isDead = true;
|
||||
}
|
||||
|
||||
|
|
@ -238,6 +241,9 @@ public class TraditionalT9 extends MainViewHandler {
|
|||
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");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ abstract class UiHandler extends AbstractHandler {
|
|||
if (mainView == null) {
|
||||
mainView = new ResizableMainView(getFinalContext());
|
||||
initTray();
|
||||
} else {
|
||||
mainView.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,11 +52,16 @@ public class ResizableMainView extends MainView implements View.OnAttachStateCha
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
public void stopListeners() {
|
||||
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