mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1454309 - Explicitly close storage connection before dispatching to connection pool; r=asuth
This commit is contained in:
parent
08466b9af3
commit
75905dc334
@ -6070,6 +6070,9 @@ public:
|
||||
nsresult
|
||||
Register(mozIStorageConnection* aConnection,
|
||||
DatabaseOperationBase* aDatabaseOp);
|
||||
|
||||
void
|
||||
Unregister();
|
||||
};
|
||||
|
||||
class TransactionDatabaseOperationBase
|
||||
@ -20471,10 +20474,7 @@ AutoSetProgressHandler::~AutoSetProgressHandler()
|
||||
MOZ_ASSERT(!IsOnBackgroundThread());
|
||||
|
||||
if (mConnection) {
|
||||
nsCOMPtr<mozIStorageProgressHandler> oldHandler;
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mConnection->RemoveProgressHandler(getter_AddRefs(oldHandler)));
|
||||
MOZ_ASSERT(oldHandler == mDEBUGDatabaseOp);
|
||||
Unregister();
|
||||
}
|
||||
}
|
||||
|
||||
@ -20508,6 +20508,21 @@ AutoSetProgressHandler::Register(mozIStorageConnection* aConnection,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
DatabaseOperationBase::
|
||||
AutoSetProgressHandler::Unregister()
|
||||
{
|
||||
MOZ_ASSERT(!IsOnBackgroundThread());
|
||||
MOZ_ASSERT(mConnection);
|
||||
|
||||
nsCOMPtr<mozIStorageProgressHandler> oldHandler;
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mConnection->RemoveProgressHandler(getter_AddRefs(oldHandler)));
|
||||
MOZ_ASSERT(oldHandler == mDEBUGDatabaseOp);
|
||||
|
||||
mConnection = nullptr;
|
||||
}
|
||||
|
||||
MutableFile::MutableFile(nsIFile* aFile,
|
||||
Database* aDatabase,
|
||||
FileInfo* aFileInfo)
|
||||
@ -21654,6 +21669,12 @@ OpenDatabaseOp::DoDatabaseWork()
|
||||
|
||||
mFileManager = fileManager.forget();
|
||||
|
||||
// Must close connection before dispatching otherwise we might race with the
|
||||
// connection thread which needs to open the same database.
|
||||
asph.Unregister();
|
||||
|
||||
MOZ_ALWAYS_SUCCEEDS(connection->Close());
|
||||
|
||||
// Must set mState before dispatching otherwise we will race with the owning
|
||||
// thread.
|
||||
mState = (mMetadata->mCommonMetadata.version() == mRequestedVersion) ?
|
||||
|
Loading…
Reference in New Issue
Block a user