mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1339617 - move GetClosure call prior to canceling timer; r=mayhemer
Some recent work on timers changed how we handle callbacks and associated closure data: prior to these changes, canceling timers would not null out associated closure data, so calling GetClosure() on a timer after canceling it would return what you had put in. After these changes, however, GetClosure() after cancellation would retrieve a null value, causing anything that assumed non-nullness to crash. The simple fix is to move the GetClosure() call prior to Cancel()'ing the timer.
This commit is contained in:
parent
13a46e3d87
commit
2f23818440
2
netwerk/cache/nsDeleteDir.cpp
vendored
2
netwerk/cache/nsDeleteDir.cpp
vendored
@ -80,10 +80,10 @@ nsDeleteDir::Shutdown(bool finishDeleting)
|
||||
for (int32_t i = gInstance->mTimers.Count(); i > 0; i--) {
|
||||
nsCOMPtr<nsITimer> timer = gInstance->mTimers[i-1];
|
||||
gInstance->mTimers.RemoveObjectAt(i-1);
|
||||
timer->Cancel();
|
||||
|
||||
nsCOMArray<nsIFile> *arg;
|
||||
timer->GetClosure((reinterpret_cast<void**>(&arg)));
|
||||
timer->Cancel();
|
||||
|
||||
if (finishDeleting)
|
||||
dirsToRemove.AppendObjects(*arg);
|
||||
|
Loading…
Reference in New Issue
Block a user