mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-11 02:38:33 +00:00
Fix possible data source invalidation loop.
This commit is contained in:
parent
b80c339c5a
commit
8d3a91f3a4
@ -130,23 +130,16 @@ class ConversationDataSource extends PositionalDataSource<MessageRecord> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static class Invalidator {
|
static class Invalidator {
|
||||||
private boolean invalidated;
|
|
||||||
private Runnable callback;
|
private Runnable callback;
|
||||||
|
|
||||||
synchronized void invalidate() {
|
synchronized void invalidate() {
|
||||||
invalidated = true;
|
|
||||||
|
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.run();
|
callback.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void observe(@NonNull Runnable callback) {
|
private synchronized void observe(@NonNull Runnable callback) {
|
||||||
if (invalidated) {
|
this.callback = callback;
|
||||||
callback.run();
|
|
||||||
} else {
|
|
||||||
this.callback = callback;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user