1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(chatform): crash after opening chat in new window

This commit is contained in:
bodwok 2019-07-29 15:51:45 +03:00
parent 174d6ef8ca
commit 59a59fdc09
No known key found for this signature in database
GPG Key ID: A279D059178DA7BA
2 changed files with 3 additions and 3 deletions

View File

@ -155,7 +155,7 @@ FriendWidget* ContentDialog::addFriend(std::shared_ptr<FriendChatroom> chatroom,
{ {
const auto compact = Settings::getInstance().getCompactLayout(); const auto compact = Settings::getInstance().getCompactLayout();
auto frnd = chatroom->getFriend(); auto frnd = chatroom->getFriend();
auto friendPk = frnd->getPublicKey(); const auto& friendPk = frnd->getPublicKey();
auto friendWidget = new FriendWidget(chatroom, compact); auto friendWidget = new FriendWidget(chatroom, compact);
emit connectFriendWidget(*friendWidget); emit connectFriendWidget(*friendWidget);
contactWidgets[friendPk] = friendWidget; contactWidgets[friendPk] = friendWidget;
@ -176,7 +176,7 @@ FriendWidget* ContentDialog::addFriend(std::shared_ptr<FriendChatroom> chatroom,
GroupWidget* ContentDialog::addGroup(std::shared_ptr<GroupChatroom> chatroom, GenericChatForm* form) GroupWidget* ContentDialog::addGroup(std::shared_ptr<GroupChatroom> chatroom, GenericChatForm* form)
{ {
const auto g = chatroom->getGroup(); const auto g = chatroom->getGroup();
const auto groupId = g->getPersistentId(); const auto& groupId = g->getPersistentId();
const auto compact = Settings::getInstance().getCompactLayout(); const auto compact = Settings::getInstance().getCompactLayout();
auto groupWidget = new GroupWidget(chatroom, compact); auto groupWidget = new GroupWidget(chatroom, compact);
contactWidgets[groupId] = groupWidget; contactWidgets[groupId] = groupWidget;

View File

@ -63,7 +63,7 @@ FriendWidget* ContentDialogManager::addFriendToDialog(ContentDialog* dialog,
GenericChatForm* form) GenericChatForm* form)
{ {
auto friendWidget = dialog->addFriend(chatroom, form); auto friendWidget = dialog->addFriend(chatroom, form);
const auto friendPk = friendWidget->getFriend()->getPublicKey(); const auto& friendPk = friendWidget->getFriend()->getPublicKey();
ContentDialog* lastDialog = getFriendDialog(friendPk); ContentDialog* lastDialog = getFriendDialog(friendPk);
if (lastDialog) { if (lastDialog) {