From: Damyan Ivanov Date: Tue, 5 Mar 2019 19:18:39 +0000 (+0200) Subject: increment the background task counter immediately before starting the task X-Git-Tag: v0.8~45 X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=commitdiff_plain;h=ca3ae83e42a5a3d553101150711e5edb9f7d085c increment the background task counter immediately before starting the task so that the try/finally construct guarantees the correct counting --- diff --git a/app/src/main/java/net/ktnx/mobileledger/async/UpdateTransactionsTask.java b/app/src/main/java/net/ktnx/mobileledger/async/UpdateTransactionsTask.java index f8e262ef..4edf5c12 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/UpdateTransactionsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/UpdateTransactionsTask.java @@ -35,11 +35,11 @@ import java.util.Date; public class UpdateTransactionsTask extends AsyncTask { protected String doInBackground(String[] filterAccName) { - Data.backgroundTaskCount.incrementAndGet(); final MobileLedgerProfile profile = Data.profile.get(); if (profile == null) return "Profile not configured"; String profile_uuid = profile.getUuid(); + Data.backgroundTaskCount.incrementAndGet(); try { ArrayList newList = new ArrayList<>();