Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd61e702 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Only populate stack when StrictMode will use it." into ics-mr1

parents b8c76afe 7978a414
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ import android.util.Log;

    /** the following are for debugging purposes */
    private String mSqlStmt = null;
    private Throwable mStackTrace = null;
    private final Throwable mStackTrace;

    /** when in cache and is in use, this member is set */
    private boolean mInUse = false;
@@ -59,7 +59,11 @@ import android.util.Log;
        db.verifyLockOwner();
        mDatabase = db;
        mSqlStmt = sql;
        if (StrictMode.vmSqliteObjectLeaksEnabled()) {
            mStackTrace = new DatabaseObjectNotClosedException().fillInStackTrace();
        } else {
            mStackTrace = null;
        }
        nHandle = db.mNativeHandle;
        native_compile(sql);
    }
@@ -112,7 +116,7 @@ import android.util.Log;
            // 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.
            // in that case, don't print any warning.
            if (mInUse && StrictMode.vmSqliteObjectLeaksEnabled()) {
            if (mInUse && mStackTrace != null) {
                int len = mSqlStmt.length();
                StrictMode.onSqliteObjectLeaked(
                    "Releasing statement in a finalizer. Please ensure " +
+6 −2
Original line number Diff line number Diff line
@@ -95,7 +95,11 @@ public class SQLiteCursor extends AbstractWindowedCursor {
        if (query.mDatabase == null) {
            throw new IllegalArgumentException("query.mDatabase cannot be null");
        }
        if (StrictMode.vmSqliteObjectLeaksEnabled()) {
            mStackTrace = new DatabaseObjectNotClosedException().fillInStackTrace();
        } else {
            mStackTrace = null;
        }
        mDriver = driver;
        mEditTable = editTable;
        mColumnNameMap = null;
@@ -319,7 +323,7 @@ public class SQLiteCursor extends AbstractWindowedCursor {
        try {
            // if the cursor hasn't been closed yet, close it first
            if (mWindow != null) {
                if (StrictMode.vmSqliteObjectLeaksEnabled()) {
                if (mStackTrace != null) {
                    int len = mQuery.mSql.length();
                    StrictMode.onSqliteObjectLeaked(
                        "Finalizing a Cursor that has not been deactivated or closed. " +