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

Prior to 30276cec3d 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.

Pick-to: 6.5 6.6
Fixes: QTBUG-114416
Change-Id: Ie99388cd8abb7543c17df5b6b5a88e86ff86df7e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-06-19 20:06:22 +02:00
parent 843ce2759e
commit 46d69b6ca4

View File

@ -1006,19 +1006,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;
}