From 1d7265800d91c79346f03d635d5b417b3d4a7e31 Mon Sep 17 00:00:00 2001 From: Vasu Nori Date: Wed, 24 Feb 2010 12:42:46 -0800 Subject: [PATCH] yet another race condition fix to address bug:2456970 --- core/java/android/database/sqlite/SQLiteProgram.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/java/android/database/sqlite/SQLiteProgram.java b/core/java/android/database/sqlite/SQLiteProgram.java index a3a848645668..7a29cb468d51 100644 --- a/core/java/android/database/sqlite/SQLiteProgram.java +++ b/core/java/android/database/sqlite/SQLiteProgram.java @@ -57,8 +57,10 @@ public abstract class SQLiteProgram extends SQLiteClosable { mCompiledSql = new SQLiteCompiledSql(db, sql); // add it to the cache of compiled-sqls - db.addToCompiledQueries(sql, mCompiledSql); + // but before adding it and thus making it available for anyone else to use it, + // make sure it is acquired by me. mCompiledSql.acquire(); + db.addToCompiledQueries(sql, mCompiledSql); } else { // it is already in compiled-sql cache. // try to acquire the object. -- 2.11.0