Afte a little more experimenting, I think my problem described
previously was caused by instantiating the CryptoHash component
at app startup (rather than having anything to do with the scope
of the variable the instance is assigned to). The shutdown crash
described below occurs in Firefox 1.5 Beta 1 on
Windows 2000 Professional with only the default extensions
installed.

Here's a simplified test case (for Fx 1.5 beta 1):

Add this statement to firefox\components\nsUpdateService.js
with the other global constant/variable declarations at the top
of the source file (note that nsUpdateService is created at
app-startup):

var gHashComp = Components.classes["@mozilla.org/security/hash;1"].
               createInstance(Components.interfaces.nsICryptoHash);

Start Firefox, open the Options dialog, and choose the Tabs page
which includes radio button elements. Close the options dialog by
choosing 'cancel', then exit Firefox using the close widget. This
causes an unreadable memory error in XPCOM:Event Receiver
for me.

Can anyone confirm?

Charles


Charles Melhorn wrote:

Hello,

In my Firefox DP extension, I have a javascript component, called
at app-startup, in which I use the "@mozilla.org/security/hash;1"
component. I create an instance of the CryptoHash component and
assign it to a global at the beginning of my module code, like so,

const nsICryptoHash = Components.interfaces.nsICryptoHash;
var gHashComp = Components.classes["@mozilla.org/security/hash;1"].
               createInstance(nsICryptoHash);

then use the global later in the actual component. When I do this, however,
then open a dialog window with radio elements, it results in a "memory
cannot be read" error in XPCOM:Event Receiver at shutdown.
(Sounds crazy, but I when I remove the radio elements from my
test window, there is no subsequent error. Any window with radio
elements, not just my test window, causes this problem.)

I've worked around the problem by instantiating the CryptoHash
component locally, when it's needed. Still, I'm curious about what
might be causing the problem. Also, I see this component used as
both a service and as an instance in the mozilla codebase. Does it
make a difference?

Thanks,

Charles

_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to