From be330d8959dbd1a589a9d46e4ed12b5b16fffbb4 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Tue, 11 Dec 2012 11:39:08 +0100 Subject: a11y: Do not refer to destructed QObject in Windows bridge The crash could happen if a QWidget in the UI got deleted, and the AT client later tried to access the widget through the cache (qAccessibleRecentSentEvents()). Solution: Use a QPointer as a guard. Task-number: QTBUG-26187 Change-Id: I41eab158989fddfa147309b6bd91ac0cd1fe7b1a Reviewed-by: Frederik Gladhorn --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/qaccessibility') diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index d47eb060aa..39207ec6b0 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -436,7 +436,15 @@ void tst_QAccessibility::eventTest() button->hide(); QVERIFY_EVENT(button, 0, QAccessible::ObjectHide); + // Destroy a visible widget + QTestAccessibility::clearEvents(); + button->show(); + QVERIFY_EVENT(button, 0, QAccessible::ObjectShow); + delete button; + + QVERIFY_EVENT(button, 0, QAccessible::ObjectHide); + QVERIFY_EVENT(button, 0, QAccessible::ObjectDestroyed); } void tst_QAccessibility::customWidget() -- cgit v1.2.3