mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 824851: Fixed RUN_ON_THREAD to not dispatch on own thread. r=ekr
This commit is contained in:
parent
1769b4d97e
commit
9626f2d171
@ -41,11 +41,16 @@ class runnable_args_base : public nsRunnable {
|
||||
// Temporary hack. Really we want to have a template which will do this
|
||||
static inline nsresult RUN_ON_THREAD(nsIEventTarget *thread, nsIRunnable *runnable, uint32_t flags) {
|
||||
RefPtr<nsIRunnable> runnable_ref(runnable);
|
||||
|
||||
if (thread && (thread != nsRefPtr<nsIThread>(do_GetCurrentThread()))) {
|
||||
return thread->Dispatch(runnable_ref, flags);
|
||||
if (thread) {
|
||||
bool on;
|
||||
nsresult rv;
|
||||
rv = thread->IsOnCurrentThread(&on);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if(!on) {
|
||||
return thread->Dispatch(runnable_ref, flags);
|
||||
}
|
||||
}
|
||||
|
||||
return runnable_ref->Run();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user