diff --git a/Linphone/core/account/AccountProxy.cpp b/Linphone/core/account/AccountProxy.cpp index 68e1aebad..d3e32ea55 100644 --- a/Linphone/core/account/AccountProxy.cpp +++ b/Linphone/core/account/AccountProxy.cpp @@ -77,9 +77,12 @@ void AccountProxy::setSourceModel(QAbstractItemModel *model) { } auto newAccountList = dynamic_cast(model); if (newAccountList) { - connect(newAccountList, &AccountList::countChanged, this, &AccountProxy::resetDefaultAccount); - connect(newAccountList, &AccountList::defaultAccountChanged, this, &AccountProxy::resetDefaultAccount); - connect(newAccountList, &AccountList::haveAccountChanged, this, &AccountProxy::haveAccountChanged); + connect(newAccountList, &AccountList::countChanged, this, &AccountProxy::resetDefaultAccount, + Qt::QueuedConnection); + connect(newAccountList, &AccountList::defaultAccountChanged, this, &AccountProxy::resetDefaultAccount, + Qt::QueuedConnection); + connect(newAccountList, &AccountList::haveAccountChanged, this, &AccountProxy::haveAccountChanged, + Qt::QueuedConnection); } QSortFilterProxyModel::setSourceModel(model); } diff --git a/Linphone/core/address-books/LdapList.cpp b/Linphone/core/address-books/LdapList.cpp index 413b6cc75..751262cee 100644 --- a/Linphone/core/address-books/LdapList.cpp +++ b/Linphone/core/address-books/LdapList.cpp @@ -43,6 +43,7 @@ QSharedPointer LdapList::createLdapCore(const std::shared_ptrmEngine->setObjectOwnership(this, QQmlEngine::CppOwnership); } LdapList::~LdapList() { diff --git a/Linphone/core/call-history/CallHistoryList.cpp b/Linphone/core/call-history/CallHistoryList.cpp index 9ec9b6cbe..88dad89bf 100644 --- a/Linphone/core/call-history/CallHistoryList.cpp +++ b/Linphone/core/call-history/CallHistoryList.cpp @@ -44,6 +44,7 @@ CallHistoryList::createCallHistoryCore(const std::shared_ptr CallHistoryList::CallHistoryList(QObject *parent) : ListProxy(parent) { mustBeInMainThread(getClassName()); + App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership); } CallHistoryList::~CallHistoryList() { diff --git a/Linphone/core/call/CallProxy.cpp b/Linphone/core/call/CallProxy.cpp index 85bfa0a99..0f14f670d 100644 --- a/Linphone/core/call/CallProxy.cpp +++ b/Linphone/core/call/CallProxy.cpp @@ -72,8 +72,8 @@ void CallProxy::setSourceModel(QAbstractItemModel *model) { } auto newCallList = dynamic_cast(model); if (newCallList) { - connect(newCallList, &CallList::currentCallChanged, this, &CallProxy::resetCurrentCall); - connect(newCallList, &CallList::haveCallChanged, this, &CallProxy::haveCallChanged); + connect(newCallList, &CallList::currentCallChanged, this, &CallProxy::resetCurrentCall, Qt::QueuedConnection); + connect(newCallList, &CallList::haveCallChanged, this, &CallProxy::haveCallChanged, Qt::QueuedConnection); connect(this, &CallProxy::lMergeAll, newCallList, &CallList::lMergeAll); } QSortFilterProxyModel::setSourceModel(model); diff --git a/Linphone/core/conference/ConferenceInfoList.cpp b/Linphone/core/conference/ConferenceInfoList.cpp index 4f56e2876..ce5e97708 100644 --- a/Linphone/core/conference/ConferenceInfoList.cpp +++ b/Linphone/core/conference/ConferenceInfoList.cpp @@ -40,6 +40,7 @@ QSharedPointer ConferenceInfoList::create() { ConferenceInfoList::ConferenceInfoList(QObject *parent) : ListProxy(parent) { mustBeInMainThread(getClassName()); + App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership); } ConferenceInfoList::~ConferenceInfoList() { diff --git a/Linphone/core/conference/ConferenceInfoProxy.cpp b/Linphone/core/conference/ConferenceInfoProxy.cpp index 4dcde6ef5..f1c7f3f45 100644 --- a/Linphone/core/conference/ConferenceInfoProxy.cpp +++ b/Linphone/core/conference/ConferenceInfoProxy.cpp @@ -28,18 +28,24 @@ DEFINE_ABSTRACT_OBJECT(ConferenceInfoProxy) ConferenceInfoProxy::ConferenceInfoProxy(QObject *parent) : SortFilterProxy(parent) { mList = ConferenceInfoList::create(); setSourceModel(mList.get()); - connect(this, &ConferenceInfoProxy::searchTextChanged, [this] { - invalidate(); - updateCurrentDateIndex(); - }); - connect(mList.get(), &ConferenceInfoList::haveCurrentDateChanged, [this] { - invalidate(); - updateCurrentDateIndex(); - }); + connect( + this, &ConferenceInfoProxy::searchTextChanged, this, + [this] { + invalidate(); + updateCurrentDateIndex(); + }, + Qt::QueuedConnection); + connect( + mList.get(), &ConferenceInfoList::haveCurrentDateChanged, this, + [this] { + invalidate(); + updateCurrentDateIndex(); + }, + Qt::QueuedConnection); connect(mList.get(), &ConferenceInfoList::haveCurrentDateChanged, this, - &ConferenceInfoProxy::haveCurrentDateChanged); + &ConferenceInfoProxy::haveCurrentDateChanged, Qt::QueuedConnection); connect(mList.get(), &ConferenceInfoList::currentDateIndexChanged, this, - &ConferenceInfoProxy::updateCurrentDateIndex); + &ConferenceInfoProxy::updateCurrentDateIndex, Qt::QueuedConnection); } ConferenceInfoProxy::~ConferenceInfoProxy() { @@ -96,4 +102,4 @@ bool ConferenceInfoProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sou return !mList->haveCurrentDate() && mList->getCount() > 1 && mSearchText.isEmpty(); // if mlist count == 1 there is only the dummy row which we don't display alone } -} \ No newline at end of file +} diff --git a/Linphone/core/friend/FriendInitialProxy.cpp b/Linphone/core/friend/FriendInitialProxy.cpp index 0f02b7264..2dfc4cfe1 100644 --- a/Linphone/core/friend/FriendInitialProxy.cpp +++ b/Linphone/core/friend/FriendInitialProxy.cpp @@ -43,14 +43,6 @@ void FriendInitialProxy::setFilterText(const QString &filter) { } } -// void FriendInitialProxy::setSourceModel(QAbstractItemModel *sourceModel) { -// mSource = qSharedPointerCast(QSharedPointer(sourceModel)); -// } - -// QAbstractItemModel *FriendInitialProxy::sourceModel() const { -// return mSource.get(); -// } - bool FriendInitialProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { bool show = (mFilterText.isEmpty() || mFilterText == "*"); if (!show) { diff --git a/Linphone/core/friend/FriendInitialProxy.hpp b/Linphone/core/friend/FriendInitialProxy.hpp index e6857dc6f..216de761d 100644 --- a/Linphone/core/friend/FriendInitialProxy.hpp +++ b/Linphone/core/friend/FriendInitialProxy.hpp @@ -53,8 +53,6 @@ protected: virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; QString mFilterText; - QSharedPointer mSource; - DECLARE_ABSTRACT_OBJECT }; diff --git a/Linphone/core/participant/ParticipantDeviceProxy.cpp b/Linphone/core/participant/ParticipantDeviceProxy.cpp index 176d0cc34..a5e0e1daf 100644 --- a/Linphone/core/participant/ParticipantDeviceProxy.cpp +++ b/Linphone/core/participant/ParticipantDeviceProxy.cpp @@ -32,7 +32,8 @@ DEFINE_GUI_OBJECT(ParticipantDeviceProxy) ParticipantDeviceProxy::ParticipantDeviceProxy(QObject *parent) : SortFilterProxy(parent) { mParticipants = ParticipantDeviceList::create(); - connect(mParticipants.get(), &ParticipantDeviceList::countChanged, this, &ParticipantDeviceProxy::meChanged); + connect(mParticipants.get(), &ParticipantDeviceList::countChanged, this, &ParticipantDeviceProxy::meChanged, + Qt::QueuedConnection); setSourceModel(mParticipants.get()); sort(0); //, Qt::DescendingOrder); diff --git a/Linphone/core/phone-number/PhoneNumberList.cpp b/Linphone/core/phone-number/PhoneNumberList.cpp index a910dc8e4..3c8bd7c6b 100644 --- a/Linphone/core/phone-number/PhoneNumberList.cpp +++ b/Linphone/core/phone-number/PhoneNumberList.cpp @@ -36,6 +36,7 @@ QSharedPointer PhoneNumberList::create() { PhoneNumberList::PhoneNumberList(QObject *parent) : ListProxy(parent) { mustBeInMainThread(getClassName()); + App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership); App::postModelAsync([=]() { // Model thread. auto dialPlans = linphone::Factory::get()->getDialPlans(); diff --git a/Linphone/core/search/MagicSearchList.cpp b/Linphone/core/search/MagicSearchList.cpp index 4b9c47a6a..30518e8b7 100644 --- a/Linphone/core/search/MagicSearchList.cpp +++ b/Linphone/core/search/MagicSearchList.cpp @@ -39,6 +39,7 @@ QSharedPointer MagicSearchList::create() { MagicSearchList::MagicSearchList(QObject *parent) : ListProxy(parent) { mustBeInMainThread(getClassName()); + App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership); mSourceFlags = (int)linphone::MagicSearch::Source::Friends | (int)linphone::MagicSearch::Source::LdapServers; mAggregationFlag = LinphoneEnums::MagicSearchAggregation::Friend; mSearchFilter = "*"; diff --git a/Linphone/core/search/MagicSearchProxy.cpp b/Linphone/core/search/MagicSearchProxy.cpp index f4caad837..625376add 100644 --- a/Linphone/core/search/MagicSearchProxy.cpp +++ b/Linphone/core/search/MagicSearchProxy.cpp @@ -43,17 +43,25 @@ void MagicSearchProxy::setList(QSharedPointer newList) { } mList = newList; if (mList) { - connect(mList.get(), &MagicSearchList::sourceFlagsChanged, this, &MagicSearchProxy::sourceFlagsChanged); - connect(mList.get(), &MagicSearchList::aggregationFlagChanged, this, &MagicSearchProxy::aggregationFlagChanged); - connect(mList.get(), &MagicSearchList::friendCreated, this, [this](int index) { - auto proxyIndex = mapFromSource(sourceModel()->index(index, 0)); - emit friendCreated(proxyIndex.row()); - }); - connect(mList.get(), &MagicSearchList::initialized, this, [this, newList = mList.get()] { - emit newList->lSetSourceFlags(mSourceFlags); - emit newList->lSetAggregationFlag(mAggregationFlag); - emit initialized(); - }); + connect(mList.get(), &MagicSearchList::sourceFlagsChanged, this, &MagicSearchProxy::sourceFlagsChanged, + Qt::QueuedConnection); + connect(mList.get(), &MagicSearchList::aggregationFlagChanged, this, &MagicSearchProxy::aggregationFlagChanged, + Qt::QueuedConnection); + connect( + mList.get(), &MagicSearchList::friendCreated, this, + [this](int index) { + auto proxyIndex = mapFromSource(sourceModel()->index(index, 0)); + emit friendCreated(proxyIndex.row()); + }, + Qt::QueuedConnection); + connect( + mList.get(), &MagicSearchList::initialized, this, + [this, newList = mList.get()] { + emit newList->lSetSourceFlags(mSourceFlags); + emit newList->lSetAggregationFlag(mAggregationFlag); + emit initialized(); + }, + Qt::QueuedConnection); } setSourceModel(mList.get()); } diff --git a/Linphone/core/timezone/TimeZoneList.cpp b/Linphone/core/timezone/TimeZoneList.cpp index e148d4671..dd247ba8f 100644 --- a/Linphone/core/timezone/TimeZoneList.cpp +++ b/Linphone/core/timezone/TimeZoneList.cpp @@ -36,6 +36,7 @@ QSharedPointer TimeZoneList::create() { } TimeZoneList::TimeZoneList(QObject *parent) : ListProxy(parent) { + App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership); initTimeZones(); }