Closed Bug 184548 Opened 23 years ago Closed 23 years ago

XPCOM glue leaves behind exit routine after DLL is unloaded

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: adamlock, Assigned: dougt)

Details

Attachments

(1 file, 1 obsolete file)

If nsMemory::Alloc is called from a DLL using XPCOM glue (e.g. the ActiveX plugin DLL) it causes an XPCOM exit routine to be registered via NS_RegisterXPCOMExitRoutine. In the case of the Activex plugin, the DLL is unloaded when the page is torn down but it leaves the exit routine behind... When mozilla.exe exits, NS_ShutdownXPCOM calls the dud exit routine and crashes. The ActiveX plugin uses both nsString classes and nsMemory directly which can trigger this behaviour. Controls which don't fire events with long names or call IWebBrowser::Navigate might be escape this problem.
unloading of xpcom components is not supported. However, this is a pretty easy fix you are asking for.
Attached patch patch v.1 (obsolete) — Splinter Review
This should work as long as XPCOMGlueStartup is called prior to *any* usage of nsMemory and XPCOMGlueShutdown is called prior to your library being unloaded. Note that nsMemory is implictly called by our string implementations. (you could be using nsEmbedString if you are using glue).
Attached patch patch v.1Splinter Review
more context. the patch is ugly cause I am removing some ifdef DEBUG_dougt stuff.
Attachment #108803 - Attachment is obsolete: true
Comment on attachment 108804 [details] [diff] [review] patch v.1 r=adamlock Thanks Doug, this fixes the problem.
Attachment #108804 - Flags: review+
Comment on attachment 108804 [details] [diff] [review] patch v.1 applying for sr/a. I understand if its too late for 1.3a but if there's still a chance...
Attachment #108804 - Flags: superreview?(shaver)
Attachment #108804 - Flags: approval1.3a?
Comment on attachment 108804 [details] [diff] [review] patch v.1 sr=darin looks fine to me.
Attachment #108804 - Flags: superreview?(shaver) → superreview+
Comment on attachment 108804 [details] [diff] [review] patch v.1 a=asa for checkin to 1.3a
Attachment #108804 - Flags: approval1.3a? → approval1.3a+
Fixed checked into trunk. Checking in nsMemory.cpp; /cvsroot/mozilla/xpcom/glue/nsMemory.cpp,v <-- nsMemory.cpp new revision: 1.5; previous revision: 1.4 done Checking in standalone/nsXPCOMGlue.cpp; /cvsroot/mozilla/xpcom/glue/standalone/nsXPCOMGlue.cpp,v <-- nsXPCOMGlue.cpp new revision: 1.8; previous revision: 1.7 done
Status: NEW → RESOLVED
Closed: 23 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: