Accessibility Windows: Do not assert on invalid indexInParent

We try to but don't always guarantee a valid hierarchy, having
applications crash because of this is not a good idea.
The assert currently triggers when showing message boxes.
Fix for the message box case is in progress but this may happen in other
situations.

Change-Id: I6f82b23c8abfcb7f91ecde0584f0e01bd8216ca1
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
This commit is contained in:
Frederik Gladhorn 2014-06-24 16:06:04 +02:00
parent 256f810be3
commit 0272ce6417

View File

@ -502,13 +502,11 @@ HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_indexInParent(long *indexIn
if (!indexInParent)
return E_INVALIDARG;
QAccessibleInterface *par = accessible->parent();
if (!par) {
*indexInParent = -1;
*indexInParent = par ? par->indexOfChild(accessible) : -1;
if (*indexInParent < 0) {
qCWarning(lcQpaAccessibility) << "index in parent invalid:" << accessible << "parent:" << par;
return S_FALSE;
}
int indexOfChild = par->indexOfChild(accessible);
Q_ASSERT(indexOfChild >= 0);
*indexInParent = indexOfChild;
return S_OK;
}