Do not pass already_AddRefed<nsIFile> to IOUtils::RunOnBackgroundThread
Categories
(Toolkit Graveyard :: OS.File, defect, P3)
Tracking
(firefox-esr78 unaffected, firefox83 unaffected, firefox84 wontfix, firefox85 fixed)
Tracking | Status | |
---|---|---|
firefox-esr78 | --- | unaffected |
firefox83 | --- | unaffected |
firefox84 | --- | wontfix |
firefox85 | --- | fixed |
People
(Reporter: barret, Assigned: barret)
Details
Attachments
(1 file)
IOUtils::RunOnBackgroundThread will exit early if we cannot get an event target (e.g., during shutdown) and will then cause a crash when we drop the already_AddRefed<nsIFile> during exit, we crash in debug builds (https://searchfox.org/mozilla-central/source/mfbt/AlreadyAddRefed.h#129). We should pass nsCOMPtr<nsIFile>&& instead which also elides the addref/release pair and will have the same perf characteristics.
Assignee | ||
Updated•3 years ago
|
Assignee | ||
Comment 1•3 years ago
|
||
Passing in a callable and its arguments to RunOnBackgroundThread was fine
before we started passing in already_AddRefed<nsIFile>. However, if we fail to
get an event target, then we drop all our arguments and in debug builds
already_AddRefed<T> asserts that it was moved out of.
Now we require callers of RunOnBackgroundThread to pass in a closure that
contains all the bindings they require, which has the added bonus of making
lifetimes more explicit. As part of this refactor, all the ReadSync
etc
methods now take raw nsIFil* pointers since they are called in a scope that has
them refcounted.
Updated•3 years ago
|
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6c71b9a049a3 Pass closures to IOUtils::RunOnBackgroundThread r=nika
Comment 3•3 years ago
|
||
bugherder |
Updated•3 years ago
|
Updated•11 months ago
|
Description
•