Do not crash if the child index is out of range.
Task-number: QTBUG-29077 Change-Id: I934101cdc121e9ef99de2e9eeaef154dd4cae0d8 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
parent
af84313c62
commit
20204fe58b
@ -577,9 +577,10 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long
|
||||
|
||||
QRect rect;
|
||||
if (varID.lVal) {
|
||||
QAIPointer child = QAIPointer(accessible->child(varID.lVal - 1));
|
||||
if (child->isValid())
|
||||
rect = child->rect();
|
||||
QAIPointer child(childPointer(varID));
|
||||
if (!child)
|
||||
return E_FAIL;
|
||||
rect = child->rect();
|
||||
} else {
|
||||
rect = accessible->rect();
|
||||
}
|
||||
|
@ -3113,6 +3113,11 @@ void tst_QAccessibility::bridgeTest()
|
||||
|
||||
// **** Test accLocation ****
|
||||
long x, y, w, h;
|
||||
// Do not crash on insane arguments.
|
||||
varChild.lVal = 999;
|
||||
hr = iaccButton->accLocation(&x, &y, &w, &h, varChild);
|
||||
QCOMPARE(SUCCEEDED(hr), false);
|
||||
|
||||
hr = iaccButton->accLocation(&x, &y, &w, &h, varSELF);
|
||||
QCOMPARE(buttonRect, QRect(x, y, w, h));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user