mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 505550 - Acquire the db's mutex when cloning statements in Connection::ExecuteAsync
Hold the lock around all our API calls so we don't lose so much to the background thread. r=asuth
This commit is contained in:
parent
5a66fb8a7c
commit
6631ab6c3b
@ -630,6 +630,8 @@ Connection::ExecuteAsync(mozIStorageStatement **aStatements,
|
||||
{
|
||||
int rc = SQLITE_OK;
|
||||
nsTArray<StatementData> stmts(aNumStatements);
|
||||
{
|
||||
SQLiteMutexAutoLock lockedScope(mDBMutex);
|
||||
for (PRUint32 i = 0; i < aNumStatements && rc == SQLITE_OK; i++) {
|
||||
sqlite3_stmt *old_stmt =
|
||||
static_cast<Statement *>(aStatements[i])->nativeStatement();
|
||||
@ -665,7 +667,8 @@ Connection::ExecuteAsync(mozIStorageStatement **aStatements,
|
||||
rc = SQLITE_NOMEM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // for loop
|
||||
} // locked Scope
|
||||
|
||||
// Dispatch to the background
|
||||
nsresult rv = NS_OK;
|
||||
@ -682,8 +685,11 @@ Connection::ExecuteAsync(mozIStorageStatement **aStatements,
|
||||
}
|
||||
|
||||
// Always reset all the statements
|
||||
{
|
||||
SQLiteMutexAutoLock lockedScope(mDBMutex);
|
||||
for (PRUint32 i = 0; i < aNumStatements; i++)
|
||||
(void)aStatements[i]->Reset();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user