Loading core/java/android/database/sqlite/SQLiteCompiledSql.java +5 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,11 @@ import android.util.Log; protected void finalize() throws Throwable { try { if (nStatement == 0) return; // don't worry about finalizing this object if it is ALREADY in the // queue of statements to be finalized later if (mDatabase.isInQueueOfStatementsToBeFinalized(nStatement)) { return; } // finalizer should NEVER get called // but if the database itself is not closed and is GC'ed, then // all sub-objects attached to the database could end up getting GC'ed too. Loading core/java/android/database/sqlite/SQLiteDatabase.java +11 −0 Original line number Diff line number Diff line Loading @@ -2274,6 +2274,17 @@ public class SQLiteDatabase extends SQLiteClosable { } } /* package */ boolean isInQueueOfStatementsToBeFinalized(int id) { if (!isOpen()) { // database already closed. this statement will already have been finalized. // return true so that the caller doesn't have to worry about finalizing this statement. return true; } synchronized(mClosedStatementIds) { return mClosedStatementIds.contains(id); } } /* package */ void closePendingStatements() { if (!isOpen()) { // since this database is already closed, no need to finalize anything. Loading Loading
core/java/android/database/sqlite/SQLiteCompiledSql.java +5 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,11 @@ import android.util.Log; protected void finalize() throws Throwable { try { if (nStatement == 0) return; // don't worry about finalizing this object if it is ALREADY in the // queue of statements to be finalized later if (mDatabase.isInQueueOfStatementsToBeFinalized(nStatement)) { return; } // finalizer should NEVER get called // but if the database itself is not closed and is GC'ed, then // all sub-objects attached to the database could end up getting GC'ed too. Loading
core/java/android/database/sqlite/SQLiteDatabase.java +11 −0 Original line number Diff line number Diff line Loading @@ -2274,6 +2274,17 @@ public class SQLiteDatabase extends SQLiteClosable { } } /* package */ boolean isInQueueOfStatementsToBeFinalized(int id) { if (!isOpen()) { // database already closed. this statement will already have been finalized. // return true so that the caller doesn't have to worry about finalizing this statement. return true; } synchronized(mClosedStatementIds) { return mClosedStatementIds.contains(id); } } /* package */ void closePendingStatements() { if (!isOpen()) { // since this database is already closed, no need to finalize anything. Loading