From ff39e92d8b42fbf20eeeab56b0599d5e3db79a21 Mon Sep 17 00:00:00 2001 From: Joanna Hulboj Date: Tue, 21 Nov 2017 15:55:35 +0000 Subject: Fix Emoji crash on insertion Swift would crash randomly when user clicked to insert an Emoji. It was happening because we would delete the emojisGrid_ while it was still in use (was closing). Test-Information: Tested on Windows 10 and Ubuntu 16.04. Tested by inserting an Emoji from the Emoji selector. This action does not result in crash any more. Change-Id: I6c0b84ea8969c7f7a4c3bfa700e345cdf63325e6 diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 7051683..874f710 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -707,9 +707,9 @@ void QtChatWindow::handleEmojiClicked(QString emoji) { if (isVisible()) { input_->textCursor().insertText(emoji); input_->setFocus(); - // The next line also deletes the emojisGrid_, as it was added to the - // layout of the emojisMenu_. - emojisMenu_.reset(); + // We cannot delete the emojisGrid_ + // Grid may not close yet and we should not try to destroy it. + emojisMenu_->setVisible(false); } } -- cgit v0.10.2-6-g49f6