1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 17:59:33 +02:00

fixed ANR

This commit is contained in:
Nikolay Pultsin 2015-09-04 12:42:39 +01:00
parent 224cea97c1
commit c2bafbed15
2 changed files with 17 additions and 15 deletions

View file

@ -624,27 +624,29 @@ public final class FBReaderApp extends ZLApplication {
return;
}
final ZLTextView textView = getTextView();
// textView.model will not be changed inside synchronised block
synchronized (textView) {
final BookModel model = Model;
final Book book = model != null ? model.Book : null;
if (book == null || textView != BookTextView || textView.getModel() == null) {
return;
}
cursor = new ZLTextWordCursor(cursor);
if (cursor.isNull()) {
return;
}
updateInvisibleBookmarksList(new Bookmark(
Collection,
book,
textView.getModel().getId(),
new AutoTextSnippet(cursor, 30),
false
));
final ZLTextView textView = getTextView();
final ZLTextModel textModel;
final Book book;
final AutoTextSnippet snippet;
// textView.model will not be changed inside synchronised block
synchronized (textView) {
textModel = textView.getModel();
final BookModel model = Model;
book = model != null ? model.Book : null;
if (book == null || textView != BookTextView || textModel == null) {
return;
}
snippet = new AutoTextSnippet(cursor, 30);
}
updateInvisibleBookmarksList(new Bookmark(
Collection, book, textModel.getId(), snippet, false
));
}
public void addInvisibleBookmark() {

View file

@ -89,7 +89,7 @@ public abstract class ZLTextView extends ZLTextViewBase {
Application.getViewWidget().reset();
}
public ZLTextModel getModel() {
public final ZLTextModel getModel() {
return myModel;
}