Bug 479729 - Unable to shutdown using async statements.

This changeset finalizes statements before we try to rollback a transaction with
the async storage API.  This problem only came up when you canceled a statement.
r=asuth
This commit is contained in:
Shawn Wilsher 2009-02-26 12:55:47 -05:00
parent 7e1b0db13a
commit 924eedb602

View File

@ -495,6 +495,14 @@ private:
NS_ASSERTION(mState != PENDING,
"Still in a pending state when calling Complete!");
// Finalize our statements before we try to commit or rollback. If we are
// canceling and have statements that think they have pending work, the
// rollback will fail.
for (PRUint32 i = 0; i < mStatements.Length(); i++) {
(void)sqlite3_finalize(mStatements[i]);
mStatements[i] = NULL;
}
// Handle our transaction, if we have one
if (mTransactionManager) {
if (mState == COMPLETED) {
@ -512,12 +520,6 @@ private:
mTransactionManager = nsnull;
}
// Finalize our statements
for (PRUint32 i = 0; i < mStatements.Length(); i++) {
(void)sqlite3_finalize(mStatements[i]);
mStatements[i] = NULL;
}
// Notify about completion iff we have a callback.
if (mCallback) {
nsRefPtr<CompletionNotifier> completionEvent =