Closed Bug 16543 Opened 26 years ago Closed 25 years ago

Must not use |QueryInterface()| as a factory

Categories

(Core :: XPCOM, defect, P3)

All
Mac System 8.5
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: scc-obsolete, Assigned: scc-obsolete)

Details

Attachments

(1 file)

Can't use |QueryInterface()| as a factory, that violates [XP]COMs rules about always returning the same pointer for a given query against a given object. This will end up breaking XPConnect (and anything that makes the same basic assumptions) and causing asserts in |nsCOMPtr|s type checks. This is not the same thing as aggregation, where the new object created in |QueryInterface()| would be saved and returned again next time. See <http://lxr.mozilla.org/seamonkey/source/layout/base/src/nsRangeList.cpp#1447> <http://lxr.mozilla.org/seamonkey/source/gfx/src/mac/nsRegionMac.cpp#131> for two cases that I've caught so far. I expect to find others.
Status: NEW → ASSIGNED
Gosh! gosh... I sincerely hope these be the exception.
Target Milestone: M12
It's not dogfood, I think, since no user-visible bad behavior can be attributed to it, but it's likely to cause bugs and needs to be fixed soon. Marking for M12.
I fixed the second case in nsRegionMac.cpp.
Cc:ing Joe Francis - he originally wrote nsRangeList.cpp.
nope. I wrote most of nsRange.cpp, but not nsRangeList.cpp. That is the selection implementation, and is owned by mjudge. cc'ing him instead.
Target Milestone: M12 → M13
Not dogfood.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
As far as mjudge and I can tell, no callers remain who |QueryInterface| for an enumerator in |nsRangeList|. All callers have been fixed to call |GetEnumerator| instead. Just in case we missed one, however, we have not totally deleted the QI clause for enumerator types. We replaced it with an assert so we can catch and fix any stragglers.
I've hit the assert (see 18th Jan 2000 comment) in a mozilla built from the 19th Jan tar ball. I'm running on NT. I was attempting to copy the text "Workplace, health, safety and welfare IND(G)244L" out of page http://www.hse.gov.uk/press/e98175.htm
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached file stack trace
Moving to M14 from M13.
Target Milestone: M13 → M14
Looking at the source code, the culprit indicated by your stack trace is using the correct code (see line 606 of <http://lxr.mozilla.org/mozilla/source/layout/ base/src/nsGenericDOMDataNode.cpp>) checked in in version 3.32 on the 19th. I suspect that this was checked in after the verification on that day... and the tar-balls were made from the verified pull, so the Jan 19 tar-ball just missed this fix by inches.
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: