From kfm-devel Thu Oct 25 08:48:53 2001 From: Martijn Klingens Date: Thu, 25 Oct 2001 08:48:53 +0000 To: kfm-devel Subject: Re: CSSStyleSheetImpl::doc() can be uninitialized??? X-MARC-Message: https://marc.info/?l=kfm-devel&m=100399963621189 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