mozcomps meta-component build crashes at startup after first run

RESOLVED INVALID

Status

()

RESOLVED INVALID
16 years ago
12 years ago

People

(Reporter: bryner, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

16 years ago
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.
(Reporter)

Comment 2

16 years ago
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 (?)
(Reporter)

Comment 6

16 years ago
Conrad: with --enable-componentlib, components are registered using the static
component loader, which doesn't have this problem.
(Reporter)

Comment 7

16 years ago
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)
(Reporter)

Updated

12 years ago
Assignee: bryner → nobody
QA Contact: ian → layout

Comment 8

12 years ago
mozcomps is no more
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.