1
0
Fork 0

a different attempt to clear the MainView in onDestroy(), again to prevent crashing

This commit is contained in:
sspanak 2025-03-17 11:56:08 +02:00 committed by Dimo Karaivanov
parent 15c618bc0b
commit 8420c6c961
3 changed files with 9 additions and 17 deletions

View file

@ -57,7 +57,7 @@ abstract public class MainViewHandler extends HotkeyHandler {
orientationListener = null;
}
if (mainView != null) {
mainView.stopListeners();
mainView.destroy();
}
}

View file

@ -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");
}

View file

@ -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();
}