From: masensio Date: Thu, 3 Apr 2014 15:24:03 +0000 (+0200) Subject: Grant that same result is never processed twice by the same listener (one through... X-Git-Tag: oc-android-1.7.0_signed~345^2~11 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/40f5eb6de6f778997efe0d9e4e740f9355938f3e?ds=inline;hp=-c Grant that same result is never processed twice by the same listener (one through callback, one through getResult) --- 40f5eb6de6f778997efe0d9e4e740f9355938f3e diff --git a/src/com/owncloud/android/services/OperationsService.java b/src/com/owncloud/android/services/OperationsService.java index 81a4adee..af177075 100644 --- a/src/com/owncloud/android/services/OperationsService.java +++ b/src/com/owncloud/android/services/OperationsService.java @@ -443,12 +443,11 @@ public class OperationsService extends Service { } finally { synchronized(mPendingOperations) { mPendingOperations.poll(); - mOperationResults.put(mCurrentOperation.hashCode(), result); } } //sendBroadcastOperationFinished(mLastTarget, mCurrentOperation, result); - callbackOperationListeners(mLastTarget, mCurrentOperation, result); + dispatchOperationListeners(mLastTarget, mCurrentOperation, result); } } @@ -506,7 +505,7 @@ public class OperationsService extends Service { * @param operation Finished operation. * @param result Result of the operation. */ - private void callbackOperationListeners( + private void dispatchOperationListeners( Target target, final RemoteOperation operation, final RemoteOperationResult result) { int count = 0; Iterator listeners = mBinder.mBoundListeners.keySet().iterator(); @@ -523,6 +522,9 @@ public class OperationsService extends Service { count += 1; } } + if (count == 0) { + mOperationResults.put(operation.hashCode(), result); + } Log_OC.d(TAG, "Called " + count + " listeners"); }