mirror of https://github.com/M66B/FairEmail.git
Prevent crash
This commit is contained in:
parent
6ed02843df
commit
e0db116401
|
@ -69,6 +69,7 @@ public class ServiceTileUnseen extends TileService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
|
owner.destroy();
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ public class TwoStateOwner implements LifecycleOwner {
|
||||||
owner.getLifecycle().addObserver(new LifecycleObserver() {
|
owner.getLifecycle().addObserver(new LifecycleObserver() {
|
||||||
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
||||||
public void onDestroyed() {
|
public void onDestroyed() {
|
||||||
registry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,15 @@ public class TwoStateOwner implements LifecycleOwner {
|
||||||
}
|
}
|
||||||
|
|
||||||
void restart() {
|
void restart() {
|
||||||
registry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
stop();
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void destroy() {
|
||||||
|
if (!registry.getCurrentState().equals(Lifecycle.State.DESTROYED))
|
||||||
|
registry.handleLifecycleEvent(Lifecycle.Event.ON_DESTROY);
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Lifecycle getLifecycle() {
|
public Lifecycle getLifecycle() {
|
||||||
|
|
Loading…
Reference in New Issue