| Index: libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java | 
| diff --git a/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java b/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java | 
| index 0840fa3e182bd8896eae3fb937c1415504657cdb..bd2a25719538651340710c400e0180401770b476 100644 | 
| --- a/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java | 
| +++ b/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java | 
| @@ -106,9 +106,6 @@ public class AdblockHelper | 
| SharedPreferences prefs = context.getSharedPreferences(preferenceName, Context.MODE_PRIVATE); | 
| storage = new SharedPrefsStorage(prefs); | 
|  | 
| -    // latch is required for async (see `waitForReady()`) | 
| -    engineCreated = new CountDownLatch(1); | 
| - | 
| engine = AdblockEngine.create( | 
| AdblockEngine.generateAppInfo(context, developmentBuild), | 
| context.getCacheDir().getAbsolutePath(), | 
| @@ -129,9 +126,6 @@ public class AdblockHelper | 
| { | 
| Log.w(TAG, "No saved adblock settings"); | 
| } | 
| - | 
| -    // unlock waiting client thread | 
| -    engineCreated.countDown(); | 
| } | 
|  | 
| /** | 
| @@ -142,7 +136,7 @@ public class AdblockHelper | 
| { | 
| if (engineCreated == null) | 
| { | 
| -      throw new RuntimeException("AdblockHelper Plus usage exception: call retain(...) first"); | 
| +      throw new RuntimeException("AdblockHelper Plus usage exception: call retain(true) first"); | 
| } | 
|  | 
| try | 
| @@ -164,10 +158,6 @@ public class AdblockHelper | 
| engine.dispose(); | 
| engine = null; | 
|  | 
| -    // to unlock waiting client in WaitForReady() | 
| -    engineCreated.countDown(); | 
| -    engineCreated = null; | 
| - | 
| storage = null; | 
| } | 
|  | 
| @@ -196,12 +186,18 @@ public class AdblockHelper | 
| } | 
| else | 
| { | 
| +        // latch is required for async (see `waitForReady()`) | 
| +        engineCreated = new CountDownLatch(1); | 
| + | 
| new Thread(new Runnable() | 
| { | 
| @Override | 
| public void run() | 
| { | 
| createAdblock(); | 
| + | 
| +            // unlock waiting client thread | 
| +            engineCreated.countDown(); | 
| } | 
| }).start(); | 
| } | 
| @@ -215,8 +211,20 @@ public class AdblockHelper | 
| { | 
| if (referenceCounter.decrementAndGet() == 0) | 
| { | 
| -      waitForReady(); | 
| -      disposeAdblock(); | 
| +      if (engineCreated != null) | 
| +      { | 
| +        // retained asynchronously | 
| +        waitForReady(); | 
| +        disposeAdblock(); | 
| + | 
| +        // to unlock waiting client in waitForReady() | 
| +        engineCreated.countDown(); | 
| +        engineCreated = null; | 
| +      } | 
| +      else | 
| +      { | 
| +        disposeAdblock(); | 
| +      } | 
| } | 
| } | 
| } | 
|  |