mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-05 11:08:17 +00:00
Prevent crash
This commit is contained in:
parent
6ed02843df
commit
e0db116401
2 changed files with 8 additions and 2 deletions
|
@ -69,6 +69,7 @@ public class ServiceTileUnseen extends TileService {
|
|||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
owner.destroy();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public class TwoStateOwner implements LifecycleOwner {
|
|||
owner.getLifecycle().addObserver(new LifecycleObserver() {
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
||||
public void onDestroyed() {
|
||||
registry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
||||
destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -33,10 +33,15 @@ public class TwoStateOwner implements LifecycleOwner {
|
|||
}
|
||||
|
||||
void restart() {
|
||||
registry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
||||
stop();
|
||||
start();
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
if (!registry.getCurrentState().equals(Lifecycle.State.DESTROYED))
|
||||
registry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Lifecycle getLifecycle() {
|
||||
|
|
Loading…
Add table
Reference in a new issue