User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705) Build Identifier: Mozilla 1.02 Whenever there is an interface method returning an array of interfaces implemented in Python (using PyXPCOM), it seems that PyXPCOM does not take the interface type into consideration and returns just a list of plain nsISupports pointers. The explicit call of QueryInterface on these pointers helps it. This is what Mark Hammond answered me in comp.lang.python (thanks a lot by the way): >Yes, this is a bug in pyxpcom. Specifically, it seems that we ignore >the IID for arrays. The function FillSingleArray in VariantUtils.cpp >isn't passed the IID, and it should be. Reproducible: Always Steps to Reproduce: 1. create an interface A with one of methods returning an array of interfaces B 2. implement this interface A as a Python component and return Python list of (e.g. Python) objects implementing the interface B. 3. obtain the results 4. try to call any function of the interface B (not going to work) 4.5. call A::QueryInterface(B) and use it (as a workaround) Actual Results: depends on the actual interfaces and their implementations. If you haven't done step (4.5), most likely you are going to get a crash via protection violation Expected Results: call the method correctly without the additional step (4.5) I was using standalone XPCOM
This is mine, mine I tell you!
Assignee: dougt → mhammond
Status: UNCONFIRMED → NEW
Ever confirmed: true
I think we should roll ShaneC's patch for never returning NULL for an array into this too.
Status: NEW → ASSIGNED
Assignee: mhammond → nobody
Component: XPCOM → PyXPCOM
Product: Core → Other Applications
QA Contact: xpcom → pyxpcom
Version: 1.0 Branch → unspecified
This is a mass change. Every comment has "assigned-to-new" in it. I didn't look through the bugs, so I'm sorry if I change a bug which shouldn't be changed. But I guess these bugs are just bugs that were once assigned and people forgot to change the Status back when unassigning.
Status: ASSIGNED → NEW
Created attachment 549479 [details] [diff] [review] trust the interface to return the right thing Actually, it looks like Python is returning the right result; it's on the other side that things fail - we assume all returning interfaces are nsISupports rather than whatever was indicated on the IDL. That breaks the interface flattening, and therefore things go bad.
Attachment #549479 - Flags: review?(toddw)
Push in change: http://hg.mozilla.org/pyxpcom/rev/e263b3d21ad2
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.