Guard against inputMethodEvent destroying the field.

This commit is contained in:
John Preston 2020-06-08 12:13:15 +04:00
parent dbcb6a35b0
commit 4ef97b57f6

View file

@ -2901,10 +2901,15 @@ void InputField::inputMethodEventInner(QInputMethodEvent *e) {
startPlaceholderAnimation();
}
_inputMethodCommit = e->commitString();
const auto weak = Ui::MakeWeak(this);
_inner->QTextEdit::inputMethodEvent(e);
const auto text = *base::take(_inputMethodCommit);
if (!processMarkdownReplaces(text)) {
processInstantReplaces(text);
if (weak) {
const auto text = *base::take(_inputMethodCommit);
if (!processMarkdownReplaces(text)) {
processInstantReplaces(text);
}
}
}