iOS: Tear down all text interaction recognizers on focus object change

Prior to 30276cec3d47f4f4fa847fea90214ec5c28d54ed all the recognizers
were managed together, so we could safely condition teardown of them
all by checking for the presence of one of them.

Now that we selectively enable only some of the recognizers, we need
to have more granular teardown logic. For extra safety, we tear down
each one individually now, even if some of them are still managed
together.

Fixes: QTBUG-114416
Change-Id: Ie99388cd8abb7543c17df5b6b5a88e86ff86df7e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
(cherry picked from commit 46d69b6ca45ad9218a27f7db8fccba8a8f655ecc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2023-06-19 20:06:22 +02:00 committed by Qt Cherry-pick Bot
parent f4ca871977
commit ec39297898

View File

@ -996,19 +996,26 @@ QIOSTextInputOverlay::~QIOSTextInputOverlay()
void QIOSTextInputOverlay::updateFocusObject()
{
// Destroy old recognizers since they were created with
// dependencies to the old focus object (focus view).
if (m_cursorRecognizer) {
// Destroy old recognizers since they were created with
// dependencies to the old focus object (focus view).
m_cursorRecognizer.enabled = NO;
m_selectionRecognizer.enabled = NO;
m_openMenuOnTapRecognizer.enabled = NO;
[m_cursorRecognizer release];
[m_selectionRecognizer release];
[m_openMenuOnTapRecognizer release];
[s_editMenu release];
m_cursorRecognizer = nullptr;
}
if (m_selectionRecognizer) {
m_selectionRecognizer.enabled = NO;
[m_selectionRecognizer release];
m_selectionRecognizer = nullptr;
}
if (m_openMenuOnTapRecognizer) {
m_openMenuOnTapRecognizer.enabled = NO;
[m_openMenuOnTapRecognizer release];
m_openMenuOnTapRecognizer = nullptr;
}
if (s_editMenu) {
[s_editMenu release];
s_editMenu = nullptr;
}