Open Bug 229080 Opened 21 years ago Updated 2 years ago

PresContext should never have a null PresShell

Categories

(Core :: Layout, defect)

defect

Tracking

()

People

(Reporter: bryner, Unassigned)

References

(Blocks 2 open bugs)

Details

We're very inconsistent about null-checking the pres shell of a pres context. Rather than adding such checks everywhere, it would be nice if the two objects were made to have the same lifetime. This would be a useful first step for combining the two objects as well (bug 154199).
Could we just make nsPresContext have an PresShell (as opposed to nsIPresShell) member?
Once we do this, the goal is to merge the two objects. However, there are some cases in printing where the lifetimes of the two objects aren't equivalent, and we need to fix that *first*. That's what this bug is about.
Blocks: 139900
Blocks: 244305
Assignee: bryner → nobody
QA Contact: layout.misc-code
(In reply to David Baron :dbaron: ⌚️UTC+1 (busy September 14-25) from comment #2) > Once we do this, the goal is to merge the two objects. However, there are > some cases in printing where the lifetimes of the two objects aren't equivalent, > and we need to fix that *first*. That's what this bug is about. I suspect this may have been addressed in bug 487667. We can't quite call this bug here fixed yet, though -- it's still possible (probably only very briefly, under normal conditions) for a nsPresContext to have a null mShell member-variable, because the method nsPresContext::DetachShell explicitly nulls out that pointer. (This method gets called when the nsPresShell gets torn down -- and the now-detached nsPresContext could potentially live beyond that, with a null mShell, since it's a refcounted object and someone could be keeping it alive. Maybe that's not really possible in practice, though?)
Depends on: 487667
(Though maybe the printing-related lifetime issues weren't addressed by bug 487667 after all -- bug 702658 was filed a few years later, about reportedly triggering a prescontext with a null presshell during print-preview).
Blocks: 702658
Product: Core → Core Graveyard
Component: Layout: Misc Code → Layout
Product: Core Graveyard → Core
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.