Use StaticAutoPtr to manage lifetime of dynamically allocated global variables in layout
Categories
(Core :: Layout, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox94 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
References
Details
Attachments
(3 files)
Filing this bug to use StaticAutoPtr (a smart-pointer that's suitable for use as a static/global variable) to manage lifetime of some global variables in layout.
This lets us remove a bunch of explicit delete statements, which reduces our audit surface for potential double-free bugs.
| Assignee | ||
Comment 1•4 years ago
|
||
This patch doesn't change behavior.
This switch to StaticAutoPtr lets us remove a handful of explicit 'delete'
statements, since StaticAutoPtr automatically deletes its contents atomically
when it gets cleared. This reduces the potential for double-free errors.
As part of this patch, I'm also converting one local variable to a smart
pointer (UniquePtr), since it takes ownership of data from one of the global
variables that I'm touching in ths patch, and we need to perform that
ownership-transfer without deleting the data.
| Assignee | ||
Comment 2•4 years ago
|
||
This lets us remove a handful of explicit 'delete' statements, by making
deletion happen automatically when these variables are cleared.
Depends on D127335
| Assignee | ||
Comment 3•4 years ago
|
||
This lets us remove a handful of explicit 'delete' statements, by making
deletion happen automatically when these variables are cleared.
Depends on D127336
| Assignee | ||
Comment 4•4 years ago
|
||
Note, I've broken this up into 3 parts:
In part (1) I've given nsRefreshDriver its own patch since it has a tiny bit of extra complexity from the fact that it hands off the data from a global variable to a local variable.
In part (2), I'm handling variables that start with "s" (for static), which I discovered by grepping for delete s.
In part (3), I'm handling variables that start with "g" (for global), which I discovered by grepping for delete g.
Updated•4 years ago
|
Updated•4 years ago
|
| Assignee | ||
Comment 5•4 years ago
|
||
Comment 7•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/c270c9e129e3
https://hg.mozilla.org/mozilla-central/rev/88d4b2d95850
https://hg.mozilla.org/mozilla-central/rev/376240aed4be
Description
•