Brion VIBBER has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/95692


Change subject: Workaround for crash when typing too fast in search box
......................................................................

Workaround for crash when typing too fast in search box

ApiResult.cancel() doesn't cancel the operation right now, it actually
triggers additional i/o on the main thread, crashing the app with an
exception. There is no way to cancel an in-progress operation in the
HTTP library we currently use in java-mwapi.

As a workaround, don't actually cancel the operation, just let it
finish and then we'll fire a new one. This should be fixed properly
at some point.

Change-Id: Ica9b69fcd7f60f292853ea2060217df3f6dc87c1
---
M wikipedia/src/main/java/org/wikimedia/wikipedia/SearchArticlesTask.java
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/92/95692/1

diff --git 
a/wikipedia/src/main/java/org/wikimedia/wikipedia/SearchArticlesTask.java 
b/wikipedia/src/main/java/org/wikimedia/wikipedia/SearchArticlesTask.java
index 08256e1..b221aae 100644
--- a/wikipedia/src/main/java/org/wikimedia/wikipedia/SearchArticlesTask.java
+++ b/wikipedia/src/main/java/org/wikimedia/wikipedia/SearchArticlesTask.java
@@ -41,8 +41,13 @@
     @Override
     public void cancel() {
         super.cancel();
+        // @fixme current implementation of result.cancel() will crash the app 
by trying to
+        // finish and disconnect the request on the main thread. When 
result.cancel() actually
+        // works, uncomment this.
+        /*
         if (result != null) {
             result.cancel();
         }
+        */
     }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/95692
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica9b69fcd7f60f292853ea2060217df3f6dc87c1
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to