Closed Bug 205897 Opened 21 years ago Closed 18 years ago

mozcomps meta-component build crashes at startup after first run

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bryner, Unassigned)

Details

Attachments

(1 file)

A mozcomps meta-component build (--disable-shared --enable-static
--enable-meta-components=mozcomps) crashes at startup due to ordering problems
with the module constructors.  Basically, layout's module constructor
initializes nsContentUtils, which gets the XPConnect service... which re-enters
the layout module initialization and causes Bad Things such as not initializing
the classinfo globals, giving you a corrupt fastload file.

I think it would be reasonable for us to give the following rule for XPCOM
module constructors:

A module constructor should not use CreateInstance or GetService except for
components and services provided by XPCOM itself.

I've fixed this for layout and transformiix, the only two places I found where
we violate this in Mozilla.  For layout, I converted it to use the app startup
notification.  For transformiix, I did things a bit differently, since I didn't
want to cause the transofrmiix library to always be loaded at startup.  I made
it lazily initialize its globals when any of the externally-visible transformiix
classes are instantiated.
Attached patch patchSplinter Review
Comment on attachment 123483 [details] [diff] [review]
patch

peterv, could you review the transformiix changes, and dbaron, could you r+sr?
Attachment #123483 - Flags: superreview?(dbaron)
Attachment #123483 - Flags: review?(peterv)
I guess I'm not too happy with the startup observer thing -- it seems like too
much of a hack to me, and I'm not sure how the app-startup notification works
with different embedding situations.  How many things are there within the
layout module constructor that do a CreateInstance or GetService?  Is it only
nsContentUtils::Init ?
Comment on attachment 123483 [details] [diff] [review]
patch

Marking sr- to trigger response to my previous comment.
Attachment #123483 - Flags: superreview?(dbaron) → superreview-
> A module constructor should not use CreateInstance or GetService except for
components and services provided by XPCOM itself.

This seems reasonable, but do we still need this rule? dougt, alecf - wasn't
some work done recently to fix createInstance re-entrancy?

Reason I ask is that I'm using mozcomps meta-component without this patch and
I'm no longer having this problem. That may be because I'm using the
meta-component dynamically linked to the app, rather than as a component. Or,
createInstance re-entrancy is fixed (?)
Conrad: with --enable-componentlib, components are registered using the static
component loader, which doesn't have this problem.
Comment on attachment 123483 [details] [diff] [review]
patch

clearing r= request; i'll make a new patch based on dbaron's comments.
Attachment #123483 - Flags: review?(peterv)
Assignee: bryner → nobody
QA Contact: ian → layout
mozcomps is no more
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: