diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index cf2180e09..43d3f74e5 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -118,6 +118,7 @@ ChatCore::ChatCore(const std::shared_ptr &chatRoom) : QObjec ChatCore::~ChatCore() { lDebug() << "[ChatCore] delete" << this; mustBeInMainThread("~" + getClassName()); + mChatModelConnection->disconnect(); emit mChatModel->removeListener(); } diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index 00e4bc416..0563a7053 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -53,6 +53,13 @@ ChatList::~ChatList() { mModelConnection->disconnect(); } +void ChatList::disconnectItem(QSharedPointer chat) { + disconnect(chat.get(), &ChatCore::deleted, this, nullptr); + disconnect(chat.get(), &ChatCore::unreadMessagesCountChanged, this, nullptr); + disconnect(chat.get(), &ChatCore::lastUpdatedTimeChanged, this, nullptr); + disconnect(chat.get(), &ChatCore::lastMessageChanged, this, nullptr); +} + void ChatList::connectItem(QSharedPointer chat) { connect( chat.get(), &ChatCore::deleted, this, @@ -68,7 +75,7 @@ void ChatList::connectItem(QSharedPointer chat) { get(chat.get(), &i); if (i != -1) { auto modelIndex = index(i); - emit dataChanged(modelIndex, modelIndex); + if (modelIndex.isValid()) emit dataChanged(modelIndex, modelIndex); } }; connect(chat.get(), &ChatCore::unreadMessagesCountChanged, this, [this, dataChange] { @@ -117,10 +124,7 @@ void ChatList::setSelf(QSharedPointer me) { mustBeInMainThread(getClassName()); for (auto &chat : getSharedList()) { if (chat) { - disconnect(chat.get(), &ChatCore::deleted, this, nullptr); - disconnect(chat.get(), &ChatCore::unreadMessagesCountChanged, this, nullptr); - disconnect(chat.get(), &ChatCore::lastUpdatedTimeChanged, this, nullptr); - disconnect(chat.get(), &ChatCore::lastMessageChanged, this, nullptr); + disconnectItem(chat); } } mList.clear(); diff --git a/Linphone/core/chat/ChatList.hpp b/Linphone/core/chat/ChatList.hpp index 66ccbead6..d523c03a7 100644 --- a/Linphone/core/chat/ChatList.hpp +++ b/Linphone/core/chat/ChatList.hpp @@ -40,6 +40,7 @@ public: ~ChatList(); void setSelf(QSharedPointer me); void connectItem(QSharedPointer chat); + void disconnectItem(QSharedPointer chat); int findChatIndex(ChatGui *chat); bool addChatInList(QSharedPointer chatCore, bool emitAddSignal); diff --git a/Linphone/core/conference/ConferenceInfoProxy.cpp b/Linphone/core/conference/ConferenceInfoProxy.cpp index 3d77ba3f6..8db8619cf 100644 --- a/Linphone/core/conference/ConferenceInfoProxy.cpp +++ b/Linphone/core/conference/ConferenceInfoProxy.cpp @@ -37,15 +37,22 @@ ConferenceInfoProxy::ConferenceInfoProxy(QObject *parent) : LimitProxy(parent) { mList.get(), &ConferenceInfoList::haveCurrentDateChanged, this, [this] { auto sortModel = dynamic_cast(sourceModel()); - sortModel->invalidate(); // New date => sort and filter change. + if (sortModel) sortModel->invalidate(); // New date => sort and filter change. loadUntil(nullptr); }, Qt::QueuedConnection); + connect( + mList.get(), &ConferenceInfoList::rowsRemoved, this, + [this] { + auto sortModel = dynamic_cast(sourceModel()); + if (sortModel) sortModel->invalidate(); // New date => sort and filter change. + }, + Qt::QueuedConnection); connect( mList.get(), &ConferenceInfoList::confInfoInserted, this, [this](QSharedPointer data) { auto sortModel = dynamic_cast(sourceModel()); - sortModel->invalidate(); // New conf => sort change. Filter can change if on current date. + if (sortModel) sortModel->invalidate(); // New conf => sort change. Filter can change if on current date. static const QMetaMethod conferenceInfoCreatedSignal = QMetaMethod::fromSignal(&ConferenceInfoProxy::conferenceInfoCreated); if (isSignalConnected(conferenceInfoCreatedSignal)) emit conferenceInfoCreated(new ConferenceInfoGui(data)); @@ -109,6 +116,11 @@ void ConferenceInfoProxy::clear() { mList->clearData(); } +void ConferenceInfoProxy::invalidate() { + auto sortModel = dynamic_cast(sourceModel()); + if (sortModel) sortModel->invalidate(); +} + ConferenceInfoGui *ConferenceInfoProxy::getCurrentDateConfInfo(bool enableCancelledConference) { if (mList) { auto confInfo = mList->getCurrentDateConfInfo(); diff --git a/Linphone/core/conference/ConferenceInfoProxy.hpp b/Linphone/core/conference/ConferenceInfoProxy.hpp index a84802deb..95f98a397 100644 --- a/Linphone/core/conference/ConferenceInfoProxy.hpp +++ b/Linphone/core/conference/ConferenceInfoProxy.hpp @@ -47,6 +47,7 @@ public: bool getAccountConnected() const; Q_INVOKABLE void clear(); + Q_INVOKABLE void invalidate(); Q_INVOKABLE ConferenceInfoGui *getCurrentDateConfInfo(bool enableCancelledConference = false); Q_INVOKABLE int loadUntil(ConferenceInfoGui *confInfo); int loadUntil(QSharedPointer data); diff --git a/Linphone/view/Control/Display/Meeting/MeetingListView.qml b/Linphone/view/Control/Display/Meeting/MeetingListView.qml index 245a607fc..99401a7af 100644 --- a/Linphone/view/Control/Display/Meeting/MeetingListView.qml +++ b/Linphone/view/Control/Display/Meeting/MeetingListView.qml @@ -74,7 +74,11 @@ ListView { } //---------------------------------------------------------------- onAtYEndChanged: if(atYEnd) confInfoProxy.displayMore() - + + Component.onCompleted: { + console.log("meeting list view completed invalidate") + confInfoProxy.invalidate() + } Keys.onPressed: (event)=> { if(event.key == Qt.Key_Up) {