Closed Bug 305310 Opened 19 years ago Closed 19 years ago

[FIX]###!!! ASSERTION: module already initialized: '!gInitialized' when starting SeaMonkey

Categories

(Core :: Layout, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: mcsmurf, Assigned: bzbarsky)

References

Details

Attachments

(1 file, 1 obsolete file)

When i start up SeaMonkey, i get the following assertion:
###!!! ASSERTION: module already initialized: '!gInitialized'
(mozilla/layout/build/nsLayoutModule.cpp:263)

This assertion already appears before the profile manager, so during the splash
screen. It doesn't matter if a compreg.dat already exists or not.

Stacktrace (which shows the double-init i think):

NTDLL! 778813b1()
nsDebugImpl::Assertion(nsDebugImpl * const 0x00267fe8, const char * 0x01ec9b68,
const char * 0x01ec9b58, const char * 0x01ec9b18, int 263) line 266
nsDebug::Assertion(const char * 0x01ec9b68, const char * 0x01ec9b58, const char
* 0x01ec9b18, int 263) line 109
Initialize(nsIModule * 0x00f93018) line 263 + 35 bytes
nsGenericModule::Initialize(nsIComponentManager * 0x0026b490) line 272 + 10 bytes
nsGenericModule::GetClassObject(nsGenericModule * const 0x00f93018,
nsIComponentManager * 0x0026b490, const nsID & {...}, const nsID & {...}, void *
* 0x0012f408) line 360 + 12 bytes
nsNativeComponentLoader::GetFactoryFromModule(nsDll * 0x00f3ddc8, const nsID &
{...}, nsIFactory * * 0x0012f408) line 1058 + 44 bytes
nsNativeComponentLoader::GetFactory(nsNativeComponentLoader * const 0x00ea9348,
const nsID & {...}, const char * 0x00ee1bd0, const char * 0x00eaa128, nsIFactory
* * 0x0012f408) line 143 + 20 bytes
nsFactoryEntry::GetFactory(nsIFactory * * 0x0012f408, nsComponentManagerImpl *
0x0026b490) line 301 + 58 bytes
nsComponentManagerImpl::CreateInstanceByContractID(nsComponentManagerImpl *
const 0x0026b490, const char * 0x01f394f4, nsISupports * 0x00000000, const nsID
& {...}, void * * 0x0012f450) line 1976 + 16 bytes
nsComponentManagerImpl::GetServiceByContractID(nsComponentManagerImpl * const
0x0026b494, const char * 0x01f394f4, const nsID & {...}, void * * 0x01ff6a58
class nsIContentPolicy *  nsContentUtils::sContentPolicyService) line 2408 + 50
bytes
CallGetService(const char * 0x01f394f4, const nsID & {...}, void * * 0x01ff6a58
class nsIContentPolicy *  nsContentUtils::sContentPolicyService) line 95
CallGetService(const char * 0x01f394f4, nsIContentPolicy * * 0x01ff6a58 class
nsIContentPolicy *  nsContentUtils::sContentPolicyService) line 130 + 20 bytes
nsContentUtils::Init() line 164 + 15 bytes
Initialize(nsIModule * 0x00f93018) line 271 + 5 bytes
nsGenericModule::Initialize(nsIComponentManager * 0x0026b490) line 272 + 10 bytes
nsGenericModule::GetClassObject(nsGenericModule * const 0x00f93018,
nsIComponentManager * 0x0026b490, const nsID & {...}, const nsID & {...}, void *
* 0x0012fa48) line 360 + 12 bytes
nsNativeComponentLoader::GetFactoryFromModule(nsDll * 0x00f3ddc8, const nsID &
{...}, nsIFactory * * 0x0012fa48) line 1058 + 44 bytes
nsNativeComponentLoader::GetFactory(nsNativeComponentLoader * const 0x00ea9348,
const nsID & {...}, const char * 0x0026ef88, const char * 0x00eaa128, nsIFactory
* * 0x0012fa48) line 143 + 20 bytes
nsFactoryEntry::GetFactory(nsIFactory * * 0x0012fa48, nsComponentManagerImpl *
0x0026b490) line 301 + 58 bytes
nsComponentManagerImpl::CreateInstance(nsComponentManagerImpl * const
0x0026b490, const nsID & {...}, nsISupports * 0x00000000, const nsID & {...},
void * * 0x0012faa0) line 1895 + 16 bytes
CallCreateInstance(const nsID & {...}, nsISupports * 0x00000000, const nsID &
{...}, void * * 0x0012faa0) line 158
nsCreateInstanceByCID::operator()(const nsID & {...}, void * * 0x0012faa0) line
199 + 27 bytes
nsCOMPtr<nsIDOMRange>::assign_from_helper(const nsCOMPtr_helper & {...}, const
nsID & {...}) line 1292 + 18 bytes
nsCOMPtr<nsIDOMRange>::operator=(const nsCOMPtr_helper & {...}) line 781
nsTypeAheadFind::Init() line 190
nsTypeAheadFind::GetInstance() line 230 + 11 bytes
nsTypeAheadFindConstructor(nsISupports * 0x00000000, const nsID & {...}, void *
* 0x0012fbe8) line 85 + 38 bytes
nsGenericFactory::CreateInstance(nsGenericFactory * const 0x00f927e0,
nsISupports * 0x00000000, const nsID & {...}, void * * 0x0012fbe8) line 79 + 21
bytes
nsComponentManagerImpl::CreateInstanceByContractID(nsComponentManagerImpl *
const 0x0026b490, const char * 0x0012fd4c, nsISupports * 0x00000000, const nsID
& {...}, void * * 0x0012fbe8) line 1981 + 24 bytes
nsComponentManagerImpl::GetServiceByContractID(nsComponentManagerImpl * const
0x0026b494, const char * 0x0012fd4c, const nsID & {...}, void * * 0x0012fc54)
line 2408 + 50 bytes
CallGetService(const char * 0x0012fd4c, const nsID & {...}, void * * 0x0012fc54)
line 95
nsGetServiceByContractIDWithError::operator()(const nsID & {...}, void * *
0x0012fc54) line 288 + 19 bytes
nsCOMPtr<nsIObserver>::assign_from_gs_contractid_with_error(const
nsGetServiceByContractIDWithError & {...}, const nsID & {...}) line 1282 + 17 bytes
nsCOMPtr<nsIObserver>::operator=(const nsGetServiceByContractIDWithError &
{...}) line 772
nsAppStartupNotifier::Observe(nsAppStartupNotifier * const 0x00f443e8,
nsISupports * 0x00000000, const char * 0x0041bad0, const unsigned short *
0x00000000) line 99
main1(int 1, char * * 0x00262638, nsISupports * 0x00eb1a80) line 1059
main(int 1, char * * 0x00262638) line 1738 + 37 bytes
mainCRTStartup() line 338 + 17 bytes
KERNEL32! 77e9893d()

I think this assertion is somewhat new, but i'm not sure.
The problem is this line in the Initialize function (in the first call to it):
nsresult rv = nsContentUtils::Init();
Init() then does this function call:
CallGetService(NS_CONTENTPOLICY_CONTRACTID, &sContentPolicyService);
which leads back to the Initialize function again.
Assignee: dougt → nobody
Component: XPCOM → Layout
QA Contact: xpcom → layout
So the problem is that the default content policy service is in the layout
module and that we're getting it during module init.  Since people do override
this contractid, we can't just switch to an NS_GetContentPolicy or some such. 
Is there a reasonable way of doing this other than getting the content policy
service lazily?
Assignee: nobody → bzbarsky
OS: Windows 2000 → All
Priority: -- → P1
Hardware: PC → All
Target Milestone: --- → mozilla1.9alpha
*** Bug 305439 has been marked as a duplicate of this bug. ***
We could use contractIDToCID on nsIComponentRegistrar to find out if the
contract ID maps to layout's component and call CallCI or NS_GetContentPolicy
accordingly, but that might be a lot of work for something this trivial.
Can we get the content policy lazily?
Yeah, lazy is what I was leaning toward.  It involves some extra code on each
use, but that can't be helped, I guess.
Seems related to startup crash in Camino (after roc's last deCOMtamination checkin).
Severity: normal → blocker
Attached patch Be lazy (obsolete) — Splinter Review
Attachment #193468 - Flags: superreview?(peterv)
Attachment #193468 - Flags: review?(peterv)
Summary: ###!!! ASSERTION: module already initialized: '!gInitialized' when starting SeaMonkey → [FIX]###!!! ASSERTION: module already initialized: '!gInitialized' when starting SeaMonkey
Comment on attachment 193468 [details] [diff] [review]
Be lazy

Though maybe you should name sGotContentPolicy differently, because it means
you *tried* to get the content policy.
Attachment #193468 - Flags: superreview?(peterv)
Attachment #193468 - Flags: superreview+
Attachment #193468 - Flags: review?(peterv)
Attachment #193468 - Flags: review+
Attachment #193468 - Attachment is obsolete: true
Fixed.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: