From 36618bbc0f6168290642a43f17e6a066956bd26d Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Wed, 11 Jan 2017 10:52:11 +0100 Subject: [PATCH] feat(src/components/chat/ChatModel): use only one handlers instance --- submodules/linphone | 2 +- tests/src/components/chat/ChatModel.cpp | 6 ++++-- tests/src/components/chat/ChatModel.hpp | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/submodules/linphone b/submodules/linphone index fb3c9841e..6c4053d10 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit fb3c9841ee5142d1826e2674591797343bd728ff +Subproject commit 6c4053d101a99ac574346ca7c5e35e2491d727dd diff --git a/tests/src/components/chat/ChatModel.cpp b/tests/src/components/chat/ChatModel.cpp index f21297755..e945cc2b3 100644 --- a/tests/src/components/chat/ChatModel.cpp +++ b/tests/src/components/chat/ChatModel.cpp @@ -74,6 +74,8 @@ ChatModel::ChatModel (QObject *parent) : QAbstractListModel(parent) { ); m_core_handlers = CoreManager::getInstance()->getHandlers(); + m_message_handlers = make_shared(this); + QObject::connect( &(*m_core_handlers), &CoreHandlers::receivedMessage, this, [this]( @@ -236,8 +238,8 @@ void ChatModel::removeAllEntries () { void ChatModel::sendMessage (const QString &message) { shared_ptr _message = m_chat_room->createMessage(::Utils::qStringToLinphoneString(message)); - _message->setListener(make_shared(this)); - m_chat_room->sendChatMessage(_message); + _message->setListener(m_message_handlers); + m_chat_room->sendMessage(_message); insertMessageAtEnd(_message); } diff --git a/tests/src/components/chat/ChatModel.hpp b/tests/src/components/chat/ChatModel.hpp index 13df752bb..e89a61de3 100644 --- a/tests/src/components/chat/ChatModel.hpp +++ b/tests/src/components/chat/ChatModel.hpp @@ -96,6 +96,7 @@ private: std::shared_ptr m_chat_room; std::shared_ptr m_core_handlers; + std::shared_ptr m_message_handlers; }; #endif // CHAT_MODEL_H_