[SCM] Multi-format 1D/2D barcode image processing library branch, upstream, updated. 24d4480bc48cf9eabf7b2bd2f528248b0e458809

srowen srowen at 59b500cc-1b3d-0410-9834-0bbf25fbcc57
Wed Aug 4 01:31:36 UTC 2010


The following commit has been merged in the upstream branch:
commit b320f70e522f4f2c126cf2e3ff5d8db7b64fb62c
Author: srowen <srowen at 59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Date:   Sat May 15 11:28:43 2010 +0000

    Commit good fix for race condition Daniel noted
    
    git-svn-id: http://zxing.googlecode.com/svn/trunk@1366 59b500cc-1b3d-0410-9834-0bbf25fbcc57

diff --git a/android/src/com/google/zxing/client/android/DecodeThread.java b/android/src/com/google/zxing/client/android/DecodeThread.java
index f297361..75e5bad 100755
--- a/android/src/com/google/zxing/client/android/DecodeThread.java
+++ b/android/src/com/google/zxing/client/android/DecodeThread.java
@@ -27,6 +27,7 @@ import android.preference.PreferenceManager;
 
 import java.util.Hashtable;
 import java.util.Vector;
+import java.util.concurrent.CountDownLatch;
 
 /**
  * This thread does all the heavy lifting of decoding the images.
@@ -40,6 +41,7 @@ final class DecodeThread extends Thread {
   private final CaptureActivity activity;
   private final Hashtable<DecodeHintType, Object> hints;
   private Handler handler;
+  private final CountDownLatch handlerInitLatch;
 
   DecodeThread(CaptureActivity activity,
                Vector<BarcodeFormat> decodeFormats,
@@ -47,6 +49,7 @@ final class DecodeThread extends Thread {
                ResultPointCallback resultPointCallback) {
 
     this.activity = activity;
+    handlerInitLatch = new CountDownLatch(1);
 
     hints = new Hashtable<DecodeHintType, Object>(3);
 
@@ -74,13 +77,19 @@ final class DecodeThread extends Thread {
   }
 
   Handler getHandler() {
+    try {
+      handlerInitLatch.await();
+    } catch (InterruptedException ie) {
+      // continue?
+    }
     return handler;
   }
 
   @Override
   public void run() {
     Looper.prepare();
-    handler = new DecodeHandler(activity, hints);    
+    handler = new DecodeHandler(activity, hints);
+    handlerInitLatch.countDown();
     Looper.loop();
   }
 

-- 
Multi-format 1D/2D barcode image processing library



More information about the Pkg-google-commits mailing list