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;
|
orientationListener = null;
|
||||||
}
|
}
|
||||||
if (mainView != null) {
|
if (mainView != null) {
|
||||||
mainView.destroy();
|
mainView.stopListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -217,6 +217,9 @@ public class TraditionalT9 extends MainViewHandler {
|
||||||
requestHideSelf(0);
|
requestHideSelf(0);
|
||||||
cleanUp();
|
cleanUp();
|
||||||
stopSelf();
|
stopSelf();
|
||||||
|
if (mainView != null) {
|
||||||
|
mainView.destroy();
|
||||||
|
}
|
||||||
isDead = true;
|
isDead = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -238,6 +241,9 @@ public class TraditionalT9 extends MainViewHandler {
|
||||||
isDead = true;
|
isDead = true;
|
||||||
}
|
}
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
if (mainView != null) { // this run last because the MainView is used in super.onDestroy()
|
||||||
|
mainView.destroy();
|
||||||
|
}
|
||||||
Logger.d(LOG_TAG, "===> Shutdown completed");
|
Logger.d(LOG_TAG, "===> Shutdown completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ abstract class UiHandler extends AbstractHandler {
|
||||||
if (mainView == null) {
|
if (mainView == null) {
|
||||||
mainView = new ResizableMainView(getFinalContext());
|
mainView = new ResizableMainView(getFinalContext());
|
||||||
initTray();
|
initTray();
|
||||||
|
} else {
|
||||||
|
mainView.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,16 @@ public class ResizableMainView extends MainView implements View.OnAttachStateCha
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
public void stopListeners() {
|
||||||
public void destroy() {
|
|
||||||
if (main != null && main.getView() != null) {
|
if (main != null && main.getView() != null) {
|
||||||
main.getView().removeOnAttachStateChangeListener(this);
|
main.getView().removeOnAttachStateChangeListener(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
stopListeners();
|
||||||
super.destroy();
|
super.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue