mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 00:59:49 +01:00
Fix ANR when leaving MediaPreviewActivity.
This commit is contained in:
@@ -8,6 +8,8 @@ import androidx.lifecycle.DefaultLifecycleObserver;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import org.signal.core.util.concurrent.SignalExecutors;
|
||||
|
||||
/**
|
||||
* Wraps a {@link Cursor} that will be closed automatically when the {@link Lifecycle.Event}.ON_DESTROY
|
||||
* is fired from the lifecycle this object is observing.
|
||||
@@ -22,4 +24,9 @@ public class LifecycleCursorWrapper extends CursorWrapper implements DefaultLife
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
SignalExecutors.BOUNDED.execute(super::close);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user