summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-03-21 22:56:23 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-23 11:48:33 +0100
commitfe52d1853ed48d7092c6835b1ce14eb7f21fe7f5 (patch)
tree60b30c0786363fa91f45eaf483ad34f9e8ed041c /src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
parent6d9541ae96441d849e87d763a636b8f36b416764 (diff)
Accessibility: Fix crash in windowHelper
When accessing the parent, we cannot be sure that the parent interfaces are all valid. Invalid parents can happen during destruction. Another cause is unusual hierarchies, the QAbstractItemView::columnDelegate test triggers a situation where this used to crash. In addition to the actual problem, add checks for every parent() call. Change-Id: I70b2bf7bc3c02b0f33e22b81023fd24519adeba9 Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp')
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index bb5d5d13a7..9958615d45 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -612,7 +612,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
case NAVDIR_PREVIOUS:
if (!varStart.lVal){
QAccessibleInterface *parent = accessible->parent();
- if (parent) {
+ if (parent && parent->isValid()) {
int index = parent->indexOfChild(accessible);
index += (navDir == NAVDIR_NEXT) ? 1 : -1;
if (index >= 0 && index < parent->childCount())
@@ -631,8 +631,9 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
case NAVDIR_UP:
case NAVDIR_DOWN:
case NAVDIR_LEFT:
- case NAVDIR_RIGHT:
- if (QAccessibleInterface *pIface = accessible->parent()) {
+ case NAVDIR_RIGHT: {
+ QAccessibleInterface *pIface = accessible->parent();
+ if (pIface && pIface->isValid()) {
const int indexOfOurself = pIface->indexOfChild(accessible);
QRect startg = accessible->rect();
QPoint startc = startg.center();
@@ -709,6 +710,7 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIA
delete pIface;
acc = candidate;
}
+ }
break;
default:
break;