Android: Fix crash when selecting text on a TextField
The crash is due to absence of the helper class that manages the selection in QtInputDelegate. As a fix, updateInputDelegate() is introduced when setView(), where the instantiation and clearance of EditPopupMenu is made. On the other hand, the nullity of EditPopupMenu in QTEmbeddedDelegate is handled. Fixes: QTBUG-122740 Change-Id: Iac5cded7be7530dde8c739265fc9402670714d39 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit a87764789feaa0575b9f4f0957bb7ec3e3b9a4d1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
5f7324b20e
commit
d77e099200
@ -143,10 +143,20 @@ class QtEmbeddedDelegate extends QtActivityDelegateBase implements QtNative.AppS
|
|||||||
|
|
||||||
void setView(QtView view) {
|
void setView(QtView view) {
|
||||||
m_view = view;
|
m_view = view;
|
||||||
|
updateInputDelegate();
|
||||||
if (m_view != null)
|
if (m_view != null)
|
||||||
registerGlobalFocusChangeListener(m_view);
|
registerGlobalFocusChangeListener(m_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateInputDelegate() {
|
||||||
|
if (m_view == null) {
|
||||||
|
m_inputDelegate.setEditPopupMenu(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_inputDelegate.setEditPopupMenu(new EditPopupMenu(m_activity, m_view));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setRootWindowRef(long ref) {
|
public void setRootWindowRef(long ref) {
|
||||||
m_rootWindowRef = ref;
|
m_rootWindowRef = ref;
|
||||||
}
|
}
|
||||||
|
@ -405,12 +405,13 @@ public class QtInputDelegate implements QtInputConnection.QtInputConnectionListe
|
|||||||
if (!QtClipboardManager.hasClipboardText(activity))
|
if (!QtClipboardManager.hasClipboardText(activity))
|
||||||
editButtons &= ~EditContextView.PASTE_BUTTON;
|
editButtons &= ~EditContextView.PASTE_BUTTON;
|
||||||
|
|
||||||
if ((mode & CursorHandleShowEdit) == CursorHandleShowEdit && editButtons != 0) {
|
if (m_editPopupMenu != null) {
|
||||||
m_editPopupMenu.setPosition(editX, editY, editButtons,
|
if ((mode & CursorHandleShowEdit) == CursorHandleShowEdit && editButtons != 0) {
|
||||||
m_cursorHandle, m_leftSelectionHandle, m_rightSelectionHandle);
|
m_editPopupMenu.setPosition(editX, editY, editButtons,
|
||||||
} else {
|
m_cursorHandle, m_leftSelectionHandle, m_rightSelectionHandle);
|
||||||
if (m_editPopupMenu != null)
|
} else {
|
||||||
m_editPopupMenu.hide();
|
m_editPopupMenu.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user