Closed Bug 1075082 Opened 10 years ago Closed 10 years ago

add assertion to make it easier to debug orphaned style contexts

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: dbaron, Assigned: dbaron)

Details

Attachments

(2 files)

We've had a bunch of assertions recently related to orphaned style contexts following rule tree rebuilds (when we assert that all the style contexts pointing to the old rule tree are destroyed).  I thought they were going to be related to bug 931668, but the first one I debugged (bug 1067755) turned out not to be, and the other one I think is important to debug right now (bug 1060194) is not the same as bug 1067755.

I needed to add an assertion to figure out what was going on in bug 1067755, and I think that's useful to land sooner since it could help figuring out the others.
The reason this assertion is useful, by the way, is that the stack of the assertion in patch 2 leads directly to the problem, since it shows what is holding on to the style context.
Comment on attachment 8497688 [details] [diff] [review]
patch 1 - Add a helper function for the root of the root of the rule tree

Review of attachment 8497688 [details] [diff] [review]:
-----------------------------------------------------------------

r=birtles

::: layout/style/nsRuleNode.cpp
@@ +1547,5 @@
>    return next;
>  }
>  
> +nsRuleNode*
> +nsRuleNode::RuleTree()

It seems like this might as well be a const method returning a const pointer unless you anticipate modifying the returned nsRuleNode somewhere. I don't mind too much either way though.
Attachment #8497688 - Flags: review?(birtles) → review+
Comment on attachment 8497689 [details] [diff] [review]
patch 2 - Add assertion in destructor of style contexts that should have been destroyed earlier

Review of attachment 8497689 [details] [diff] [review]:
-----------------------------------------------------------------

r=birtles
Attachment #8497689 - Flags: review?(birtles) → review+
(In reply to Brian Birtles (:birtles) from comment #4)
> It seems like this might as well be a const method returning a const pointer
> unless you anticipate modifying the returned nsRuleNode somewhere. I don't
> mind too much either way though.

I'll add both; the const one can be an inline method using const_cast, to avoid any overhead.
https://hg.mozilla.org/mozilla-central/rev/11120e8d123d
https://hg.mozilla.org/mozilla-central/rev/e0f6f0f43e78
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.