Source:
<code>private void completedAsyncQueriesUpdate(QueryUpdateTask.Result result) { SharedGroup.VersionID callerVersionID = realm.sharedGroupManager.getVersion(); int compare = callerVersionID.compareTo(result.versionID); if (compare > 0) { RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:" + HandlerController.this + " caller is more advanced, rerun updates"); realm.handler.sendEmptyMessage(REALM_CHANGED); } else { if (compare != 0) { RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:"+ HandlerController.this + " caller is behind advance_read"); realm.sharedGroupManager.advanceRead(result.versionID); } ArrayList<RealmResults<? extends RealmObject>> callbacksToNotify = new ArrayList<RealmResults<? extends RealmObject>>(result.updatedTableViews.size()); for (Map.Entry<WeakReference<RealmResults<? extends RealmObject>>, Long> query : result.updatedTableViews.entrySet()) { WeakReference<RealmResults<? extends RealmObject>> weakRealmResults = query.getKey(); RealmResults<? extends RealmObject> realmResults = weakRealmResults.get(); if (realmResults == null) { asyncRealmResults.remove(weakRealmResults); } else { try { realmResults.swapTableViewPointer(query.getValue()); <START> } catch (BadVersionException e) { <END> RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:"+ HandlerController.this + "." + " TableView could not be imported. A retry should already be scheduled through a" + " REALM_CHANGED event"); continue; } callbacksToNotify.add(realmResults); RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:"+ HandlerController.this + " updating RealmResults " + weakRealmResults); } } for (RealmResults<? extends RealmObject> query : callbacksToNotify) { query.notifyChangeListeners(); } notifyGlobalListeners(); notifySyncRealmResultsCallbacks(); notifyRealmObjectCallbacks(); updateAsyncQueriesTask = null; } }</code><technical_language>above. version, advanced worker thread version, crash <LINK_0> get this block</technical_language>

Target:
private void completedAsyncQueriesUpdate(QueryUpdateTask.Result result) { SharedGroup.VersionID callerVersionID = realm.sharedGroupManager.getVersion(); int compare = callerVersionID.compareTo(result.versionID); if (compare > 0) { RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:" + HandlerController.this + " caller is more advanced, rerun updates"); realm.handler.sendEmptyMessage(REALM_CHANGED); } else { if (compare != 0) { RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:"+ HandlerController.this + " caller is behind advance_read"); try { realm.sharedGroupManager.advanceRead(result.versionID); } catch (BadVersionException e) { throw new IllegalStateException("Failed to advance Caller Realm to Worker Realm version", e); } } ArrayList<RealmResults<? extends RealmObject>> callbacksToNotify = new ArrayList<RealmResults<? extends RealmObject>>(result.updatedTableViews.size()); for (Map.Entry<WeakReference<RealmResults<? extends RealmObject>>, Long> query : result.updatedTableViews.entrySet()) { WeakReference<RealmResults<? extends RealmObject>> weakRealmResults = query.getKey(); RealmResults<? extends RealmObject> realmResults = weakRealmResults.get(); if (realmResults == null) { asyncRealmResults.remove(weakRealmResults); } else { realmResults.swapTableViewPointer(query.getValue()); callbacksToNotify.add(realmResults); RealmLog.d("COMPLETED_UPDATE_ASYNC_QUERIES realm:"+ HandlerController.this + " updating RealmResults " + weakRealmResults); } } for (RealmResults<? extends RealmObject> query : callbacksToNotify) { query.notifyChangeListeners(); } notifyGlobalListeners(); notifySyncRealmResultsCallbacks(); notifyRealmObjectCallbacks(); updateAsyncQueriesTask = null; } }