[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: CSSStyleSheetImpl::doc() can be uninitialized???
From:       Martijn Klingens <mklingens () ism ! nl>
Date:       2001-10-25 8:48:53
[Download RAW message or body]

On Wednesday 24 October 2001 17:49, Martijn Klingens wrote:
> However, this gives me an instant crash while khtml tries to load the
> default style sheet. I haven't had time to look deep into it, but I have
> the feeling that the doc() pointer is null.

Indeed it is. CSSStyleSheetImpl doesn't have a valid doc() pointer in many 
cases. I don't know how to fix this, but I am afraid that at least the 
CSSStyleSelectorList class needs to keep its own copy of mediaType 
internally. I fear that there is no way to retrieve it otherwise.

Are there any objections with that? Or am I overlooking something?

Taking the available set of constructors:

| CSSStyleSheetImpl::CSSStyleSheetImpl(CSSStyleSheetImpl *parentSheet,
| DOMString href)
|     : StyleSheetImpl(parentSheet, href)
| {
|     ...
|     m_doc = 0;
|     ...
| }

This one can be changed to use parentSheet->doc(), provided parentSheet itself
is not null.

| CSSStyleSheetImpl::CSSStyleSheetImpl(DOM::NodeImpl *parentNode,
| DOMString href, bool _implicit)

This one is ok.

| CSSStyleSheetImpl::CSSStyleSheetImpl(CSSRuleImpl *ownerRule, DOMString href)
|     : StyleSheetImpl(ownerRule, href)
| {
|     ...
|     m_doc = 0;
|     ...
| }

Impossible to fix, since CSSRuleImpl instances don't have any way to detect 
the document.

| CSSStyleSheetImpl::CSSStyleSheetImpl(DOM::NodeImpl *parentNode,
| CSSStyleSheetImpl *orig)

This one is already ok.

| CSSStyleSheetImpl::CSSStyleSheetImpl(CSSRuleImpl *ownerRule,
| CSSStyleSheetImpl *orig)
|    : StyleSheetImpl(ownerRule, orig->m_strHref)
| {
|     ...
|     m_doc  = 0;
|     ...
| }

This one cannot be fixed either.

So, unless I am missing something obvious here I think the mediaType needs to 
be actively propagated and cannot be queried by the selectorlist.

Martijn

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic