mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 525356 - windows debug unit tests: test_connection_executeAsync.js and test_statement_executeAsync.js failing frequently (fatal assertion)
Release on the calling thread so when the connections destructor is called, it is not on the background thread. r=asuth
This commit is contained in:
parent
86b40d6c0d
commit
0d37582e30
@ -43,6 +43,7 @@
|
||||
|
||||
#include "nsError.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "nsIProgrammingLanguage.h"
|
||||
@ -77,18 +78,33 @@ namespace {
|
||||
class AsyncStatementFinalizer : public nsRunnable
|
||||
{
|
||||
public:
|
||||
AsyncStatementFinalizer(sqlite3_stmt *aStatement)
|
||||
/**
|
||||
* Constructor for the event.
|
||||
*
|
||||
* @param aStatement
|
||||
* The sqlite3_stmt to finalize on the background thread.
|
||||
* @param aParent
|
||||
* The object that owns aStatement. It will be released on the calling
|
||||
* thread.
|
||||
*/
|
||||
AsyncStatementFinalizer(sqlite3_stmt *aStatement,
|
||||
nsISupports *aParent)
|
||||
: mStatement(aStatement)
|
||||
, mParent(aParent)
|
||||
, mCallingThread(do_GetCurrentThread())
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
(void)::sqlite3_finalize(mStatement);
|
||||
(void)::NS_ProxyRelease(mCallingThread, mParent);
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
sqlite3_stmt *mStatement;
|
||||
nsCOMPtr<nsISupports> mParent;
|
||||
nsCOMPtr<nsIThread> mCallingThread;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
@ -401,7 +417,7 @@ Statement::Finalize()
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
new AsyncStatementFinalizer(mCachedAsyncStatement);
|
||||
new AsyncStatementFinalizer(mCachedAsyncStatement, this);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = target->Dispatch(event, NS_DISPATCH_NORMAL);
|
||||
|
Loading…
Reference in New Issue
Block a user