Do not call QAccessible::child() with a negative index.

Fix assert on Windows:
QFATAL : tst_QAbstractItemView::testChangeEditorState():
ASSERT: "index_ >= 0" in file itemviews.cpp, line 1123

Change-Id: I4f19c68bbe00d9c75768e7125cf3b33bc09a09e5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
Jan Arve Saether 2013-07-02 16:13:31 +02:00 committed by The Qt Project
parent 671d607512
commit 14721becc3

View File

@ -564,15 +564,10 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long
if (!accessible)
return E_FAIL;
QRect rect;
if (varID.lVal) {
QAccessibleInterface *child = accessible->child(varID.lVal - 1);
if (!child || !child->isValid())
QAccessibleInterface *acc = childPointer(accessible, varID);
if (!acc || !acc->isValid())
return E_FAIL;
rect = child->rect();
} else {
rect = accessible->rect();
}
const QRect rect = acc->rect();
*pxLeft = rect.x();
*pyTop = rect.y();