Make keyClick safer for QWindows going away on presses or during wait

We already have similar logic in the QWidget variant.

Pick-to: 6.3 6.2
Task-number: QTBUG-102253
Change-Id: Idf1e3474f3189909f1cba7d5dedc2cde12f1338e
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2022-04-05 13:32:11 +02:00
parent 6569a4068b
commit ca106e261e

View File

@ -93,7 +93,10 @@ namespace QTest
if (action == Click) { if (action == Click) {
QPointer<QWindow> ptr(window);
sendKeyEvent(Press, window, code, text, modifier, delay); sendKeyEvent(Press, window, code, text, modifier, delay);
if (!ptr)
return;
sendKeyEvent(Release, window, code, text, modifier, delay); sendKeyEvent(Release, window, code, text, modifier, delay);
return; return;
} }