Fix for bug #13780. Added NULL pointer check to PreferenceChanged()

This commit is contained in:
troy%netscape.com 1999-09-14 22:16:42 +00:00
Родитель 987374301c
Коммит f521d3ac1b
2 изменённых файлов: 36 добавлений и 30 удалений

Просмотреть файл

@ -244,22 +244,25 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
// Initialize our state from the user preferences
GetUserPreferences();
// Have the root frame's style context remap its style based on the
// user preferences
nsIFrame* rootFrame;
nsIStyleContext* rootStyleContext;
if (mShell) {
// Have the root frame's style context remap its style based on the
// user preferences
nsIFrame* rootFrame;
mShell->GetRootFrame(&rootFrame);
if (nsnull != rootFrame) {
rootFrame->GetStyleContext(&rootStyleContext);
rootStyleContext->RemapStyle(this);
NS_RELEASE(rootStyleContext);
// Force a reflow of the root frame
// XXX We really should only do a reflow if a preference that affects
// formatting changed, e.g., a font change. If it's just a color change
// then we only need to repaint...
mShell->StyleChangeReflow();
mShell->GetRootFrame(&rootFrame);
if (rootFrame) {
nsIStyleContext* rootStyleContext;
rootFrame->GetStyleContext(&rootStyleContext);
rootStyleContext->RemapStyle(this);
NS_RELEASE(rootStyleContext);
// Force a reflow of the root frame
// XXX We really should only do a reflow if a preference that affects
// formatting changed, e.g., a font change. If it's just a color change
// then we only need to repaint...
mShell->StyleChangeReflow();
}
}
}

Просмотреть файл

@ -244,22 +244,25 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
// Initialize our state from the user preferences
GetUserPreferences();
// Have the root frame's style context remap its style based on the
// user preferences
nsIFrame* rootFrame;
nsIStyleContext* rootStyleContext;
if (mShell) {
// Have the root frame's style context remap its style based on the
// user preferences
nsIFrame* rootFrame;
mShell->GetRootFrame(&rootFrame);
if (nsnull != rootFrame) {
rootFrame->GetStyleContext(&rootStyleContext);
rootStyleContext->RemapStyle(this);
NS_RELEASE(rootStyleContext);
// Force a reflow of the root frame
// XXX We really should only do a reflow if a preference that affects
// formatting changed, e.g., a font change. If it's just a color change
// then we only need to repaint...
mShell->StyleChangeReflow();
mShell->GetRootFrame(&rootFrame);
if (rootFrame) {
nsIStyleContext* rootStyleContext;
rootFrame->GetStyleContext(&rootStyleContext);
rootStyleContext->RemapStyle(this);
NS_RELEASE(rootStyleContext);
// Force a reflow of the root frame
// XXX We really should only do a reflow if a preference that affects
// formatting changed, e.g., a font change. If it's just a color change
// then we only need to repaint...
mShell->StyleChangeReflow();
}
}
}