mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
Issue #2282 - Performance observer safety checks. Both fixes from later revisions, without the Dispatch API changes.
This commit is contained in:
parent
7392901a9b
commit
470af6ba50
1 changed files with 8 additions and 2 deletions
|
|
@ -675,7 +675,8 @@ public:
|
|||
NS_IMETHOD Run() override
|
||||
{
|
||||
MOZ_ASSERT(mPerformance);
|
||||
mPerformance->NotifyObservers();
|
||||
RefPtr<Performance> performance(mPerformance);
|
||||
performance->NotifyObservers();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -699,7 +700,12 @@ Performance::RunNotificationObserversTask()
|
|||
{
|
||||
mPendingNotificationObserversTask = true;
|
||||
nsCOMPtr<nsIRunnable> task = new NotifyObserversTask(this);
|
||||
nsresult rv = NS_DispatchToCurrentThread(task);
|
||||
nsresult rv;
|
||||
if (NS_IsMainThread()) {
|
||||
rv = NS_DispatchToCurrentThread(task);
|
||||
} else {
|
||||
rv = NS_DispatchToMainThread(task);
|
||||
}
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
mPendingNotificationObserversTask = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue