Closed
Bug 381312
Opened 17 years ago
Closed 17 years ago
implement IAccessibleRelation
Categories
(Core :: Disability Access APIs, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: surkov, Assigned: surkov)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 2 obsolete files)
27.03 KB,
patch
|
Details | Diff | Splinter Review |
Implementation of IAccessilbeRelation::get_targets and IAccessible::get_relations has wrong initialization of returned array. I can't get how to initialize it correctly, is it mismatch of IA2 API or do I get brake?
Attachment #265409 -
Flags: superreview?(neil)
Attachment #265409 -
Flags: review?(aaronleventhal)
Comment 1•17 years ago
|
||
Comment on attachment 265409 [details] [diff] [review] patch Looks good. Is the prefix "unk" on unkTargets and unkRelations short for "unknown"?
Attachment #265409 -
Flags: review?(aaronleventhal) → review+
Updated•17 years ago
|
Summary: implemnnt IAccessibleRelation → implement IAccessibleRelation
Comment 2•17 years ago
|
||
I suppose I should not put r+ if you say your arrays are incorrectly initialized. Could you be more specific as to what is wrong?
Comment 3•17 years ago
|
||
Comment on attachment 265409 [details] [diff] [review] patch >+// IUnknown >+ >+STDMETHODIMP >+nsAccessibleRelationWrap::QueryInterface(REFIID iid, void** ppv) >+{ >+ *ppv = NULL; >+ >+ if (IID_IAccessibleRelation == iid) { || IUnknown == iid ? >+ rv = winAccessNode->QueryNativeInterface(IID_IUnknown, &instancePtr); Nits: two spaces after = >+ IUnknown **unkTargets = new IUnknown*[count]; Don't you have to use CoTaskMemAlloc for these? >+ nsCOMPtr<nsIAccessible> target; >+ rv = targets->QueryElementAt(index, NS_GET_IID(nsIAccessible), >+ getter_AddRefs(target)); >+ if (NS_FAILED(rv)) >+ return E_FAIL; >+ >+ nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryInterface(target)); >+ if (!winAccessNode) >+ return E_FAIL; I don't see the point of going via nsIAccessible. Just use nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryElementAt(targets, index, &rv)); >+ if (NS_FAILED(rv)) >+ return E_FAIL; You need to release the previous elements and free the memory or you will leak.
Attachment #265409 -
Flags: superreview?(neil) → superreview-
Assignee | ||
Comment 4•17 years ago
|
||
(In reply to comment #2) > I suppose I should not put r+ if you say your arrays are incorrectly > initialized. Could you be more specific as to what is wrong? > Let's consider get_targets(long aMaxTargets, IUnknown **aTarget, ..). If I'd like to return an object pointer then I should initialize *aTarget. Therefore if I like to return array of IUnknown* then I should initialize ***aTarget. Correct? In the patch I do *aTarget = *unkTargets. It means I return first IUnknown pointer and the client can't get another IUnknowns.
Assignee | ||
Comment 5•17 years ago
|
||
(In reply to comment #1) > (From update of attachment 265409 [details] [diff] [review]) > Looks good. Is the prefix "unk" on unkTargets and unkRelations short for > "unknown"? > yes
Comment 6•17 years ago
|
||
(In reply to comment #4) >Let's consider get_targets(long aMaxTargets, IUnknown **aTarget, ..). If I'd >like to return an object pointer then I should initialize *aTarget. Therefore >if I like to return array of IUnknown* then I should initialize ***aTarget. >Correct? Well, that's how it works in XPCOM but MSCOM might be different. Unfortunately I don't know MSCOM so I'm having to guess here but assuming your declaration of aTarget is correct then it would appear that the caller has already allocated an array of size aMaxTargets and you merely have to write the elements in. There is also the question of who should release the elements if there is an error.
Comment 7•17 years ago
|
||
The caller is responsible for allocating the array. Mozilla is responsible for allocating space for the individual items which fill the array.
Assignee | ||
Comment 8•17 years ago
|
||
Attachment #265409 -
Attachment is obsolete: true
Attachment #265763 -
Flags: superreview?(neil)
Updated•17 years ago
|
Attachment #265763 -
Flags: superreview?(neil) → superreview+
Assignee | ||
Comment 10•17 years ago
|
||
checked in
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•