John,
I was just talking with shaver on IRC about this, was wondering if you
had any ideas about what to do. Basically, I'm trying to move a C++
implementation of an nsIURIContentListener into JS. The way these are
used are via the URILoader service:
uriLoader.registerContentListener(foo);
and uriLoader stores a weak reference to "foo" in an nsVoidArray.
but the problem is that when I go to unregister the javascript version:
uriLoader.unRegisterContentListener(foo)
a different pointer seems to get passed into unRegisterContentListener()
- so the unregistration never happens, and we're left with a weak
reference to a disposed-of wrapper object in a void array, which
subsequently causes a crash.... and just to make sure I wasn't going
crazy, I did this:
uriLoader.unRegisterContentListener(foo)
uriLoader.unRegisterContentListener(foo)
and amazingly got two different pointers from c++, neither of which
matched the original.
any thoughts? I'm holding a strong reference to the object else from
C++, but I haven't looked to see what the value of THAT pointer is yet...
Alec