Fix critical crashes:
- set cpp managment for list - remove items stored in shared pointer that are managed by Gui - queue connection for signals between GUI/Core in order to avoid calling functions while destructions.
This commit is contained in:
parent
b9417f5a72
commit
975c461a4d
13 changed files with 52 additions and 38 deletions
|
|
@ -77,9 +77,12 @@ void AccountProxy::setSourceModel(QAbstractItemModel *model) {
|
||||||
}
|
}
|
||||||
auto newAccountList = dynamic_cast<AccountList *>(model);
|
auto newAccountList = dynamic_cast<AccountList *>(model);
|
||||||
if (newAccountList) {
|
if (newAccountList) {
|
||||||
connect(newAccountList, &AccountList::countChanged, this, &AccountProxy::resetDefaultAccount);
|
connect(newAccountList, &AccountList::countChanged, this, &AccountProxy::resetDefaultAccount,
|
||||||
connect(newAccountList, &AccountList::defaultAccountChanged, this, &AccountProxy::resetDefaultAccount);
|
Qt::QueuedConnection);
|
||||||
connect(newAccountList, &AccountList::haveAccountChanged, this, &AccountProxy::haveAccountChanged);
|
connect(newAccountList, &AccountList::defaultAccountChanged, this, &AccountProxy::resetDefaultAccount,
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
connect(newAccountList, &AccountList::haveAccountChanged, this, &AccountProxy::haveAccountChanged,
|
||||||
|
Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
QSortFilterProxyModel::setSourceModel(model);
|
QSortFilterProxyModel::setSourceModel(model);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ QSharedPointer<LdapCore> LdapList::createLdapCore(const std::shared_ptr<linphone
|
||||||
|
|
||||||
LdapList::LdapList(QObject *parent) : ListProxy(parent) {
|
LdapList::LdapList(QObject *parent) : ListProxy(parent) {
|
||||||
mustBeInMainThread(getClassName());
|
mustBeInMainThread(getClassName());
|
||||||
|
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||||
}
|
}
|
||||||
|
|
||||||
LdapList::~LdapList() {
|
LdapList::~LdapList() {
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ CallHistoryList::createCallHistoryCore(const std::shared_ptr<linphone::CallLog>
|
||||||
|
|
||||||
CallHistoryList::CallHistoryList(QObject *parent) : ListProxy(parent) {
|
CallHistoryList::CallHistoryList(QObject *parent) : ListProxy(parent) {
|
||||||
mustBeInMainThread(getClassName());
|
mustBeInMainThread(getClassName());
|
||||||
|
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||||
}
|
}
|
||||||
|
|
||||||
CallHistoryList::~CallHistoryList() {
|
CallHistoryList::~CallHistoryList() {
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,8 @@ void CallProxy::setSourceModel(QAbstractItemModel *model) {
|
||||||
}
|
}
|
||||||
auto newCallList = dynamic_cast<CallList *>(model);
|
auto newCallList = dynamic_cast<CallList *>(model);
|
||||||
if (newCallList) {
|
if (newCallList) {
|
||||||
connect(newCallList, &CallList::currentCallChanged, this, &CallProxy::resetCurrentCall);
|
connect(newCallList, &CallList::currentCallChanged, this, &CallProxy::resetCurrentCall, Qt::QueuedConnection);
|
||||||
connect(newCallList, &CallList::haveCallChanged, this, &CallProxy::haveCallChanged);
|
connect(newCallList, &CallList::haveCallChanged, this, &CallProxy::haveCallChanged, Qt::QueuedConnection);
|
||||||
connect(this, &CallProxy::lMergeAll, newCallList, &CallList::lMergeAll);
|
connect(this, &CallProxy::lMergeAll, newCallList, &CallList::lMergeAll);
|
||||||
}
|
}
|
||||||
QSortFilterProxyModel::setSourceModel(model);
|
QSortFilterProxyModel::setSourceModel(model);
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ QSharedPointer<ConferenceInfoList> ConferenceInfoList::create() {
|
||||||
|
|
||||||
ConferenceInfoList::ConferenceInfoList(QObject *parent) : ListProxy(parent) {
|
ConferenceInfoList::ConferenceInfoList(QObject *parent) : ListProxy(parent) {
|
||||||
mustBeInMainThread(getClassName());
|
mustBeInMainThread(getClassName());
|
||||||
|
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConferenceInfoList::~ConferenceInfoList() {
|
ConferenceInfoList::~ConferenceInfoList() {
|
||||||
|
|
|
||||||
|
|
@ -28,18 +28,24 @@ DEFINE_ABSTRACT_OBJECT(ConferenceInfoProxy)
|
||||||
ConferenceInfoProxy::ConferenceInfoProxy(QObject *parent) : SortFilterProxy(parent) {
|
ConferenceInfoProxy::ConferenceInfoProxy(QObject *parent) : SortFilterProxy(parent) {
|
||||||
mList = ConferenceInfoList::create();
|
mList = ConferenceInfoList::create();
|
||||||
setSourceModel(mList.get());
|
setSourceModel(mList.get());
|
||||||
connect(this, &ConferenceInfoProxy::searchTextChanged, [this] {
|
connect(
|
||||||
invalidate();
|
this, &ConferenceInfoProxy::searchTextChanged, this,
|
||||||
updateCurrentDateIndex();
|
[this] {
|
||||||
});
|
invalidate();
|
||||||
connect(mList.get(), &ConferenceInfoList::haveCurrentDateChanged, [this] {
|
updateCurrentDateIndex();
|
||||||
invalidate();
|
},
|
||||||
updateCurrentDateIndex();
|
Qt::QueuedConnection);
|
||||||
});
|
connect(
|
||||||
|
mList.get(), &ConferenceInfoList::haveCurrentDateChanged, this,
|
||||||
|
[this] {
|
||||||
|
invalidate();
|
||||||
|
updateCurrentDateIndex();
|
||||||
|
},
|
||||||
|
Qt::QueuedConnection);
|
||||||
connect(mList.get(), &ConferenceInfoList::haveCurrentDateChanged, this,
|
connect(mList.get(), &ConferenceInfoList::haveCurrentDateChanged, this,
|
||||||
&ConferenceInfoProxy::haveCurrentDateChanged);
|
&ConferenceInfoProxy::haveCurrentDateChanged, Qt::QueuedConnection);
|
||||||
connect(mList.get(), &ConferenceInfoList::currentDateIndexChanged, this,
|
connect(mList.get(), &ConferenceInfoList::currentDateIndexChanged, this,
|
||||||
&ConferenceInfoProxy::updateCurrentDateIndex);
|
&ConferenceInfoProxy::updateCurrentDateIndex, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConferenceInfoProxy::~ConferenceInfoProxy() {
|
ConferenceInfoProxy::~ConferenceInfoProxy() {
|
||||||
|
|
|
||||||
|
|
@ -43,14 +43,6 @@ void FriendInitialProxy::setFilterText(const QString &filter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// void FriendInitialProxy::setSourceModel(QAbstractItemModel *sourceModel) {
|
|
||||||
// mSource = qSharedPointerCast<MagicSearchProxy>(QSharedPointer<QAbstractItemModel>(sourceModel));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// QAbstractItemModel *FriendInitialProxy::sourceModel() const {
|
|
||||||
// return mSource.get();
|
|
||||||
// }
|
|
||||||
|
|
||||||
bool FriendInitialProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
|
bool FriendInitialProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const {
|
||||||
bool show = (mFilterText.isEmpty() || mFilterText == "*");
|
bool show = (mFilterText.isEmpty() || mFilterText == "*");
|
||||||
if (!show) {
|
if (!show) {
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,6 @@ protected:
|
||||||
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||||
|
|
||||||
QString mFilterText;
|
QString mFilterText;
|
||||||
QSharedPointer<MagicSearchProxy> mSource;
|
|
||||||
|
|
||||||
DECLARE_ABSTRACT_OBJECT
|
DECLARE_ABSTRACT_OBJECT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@ DEFINE_GUI_OBJECT(ParticipantDeviceProxy)
|
||||||
|
|
||||||
ParticipantDeviceProxy::ParticipantDeviceProxy(QObject *parent) : SortFilterProxy(parent) {
|
ParticipantDeviceProxy::ParticipantDeviceProxy(QObject *parent) : SortFilterProxy(parent) {
|
||||||
mParticipants = ParticipantDeviceList::create();
|
mParticipants = ParticipantDeviceList::create();
|
||||||
connect(mParticipants.get(), &ParticipantDeviceList::countChanged, this, &ParticipantDeviceProxy::meChanged);
|
connect(mParticipants.get(), &ParticipantDeviceList::countChanged, this, &ParticipantDeviceProxy::meChanged,
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
setSourceModel(mParticipants.get());
|
setSourceModel(mParticipants.get());
|
||||||
sort(0); //, Qt::DescendingOrder);
|
sort(0); //, Qt::DescendingOrder);
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ QSharedPointer<PhoneNumberList> PhoneNumberList::create() {
|
||||||
|
|
||||||
PhoneNumberList::PhoneNumberList(QObject *parent) : ListProxy(parent) {
|
PhoneNumberList::PhoneNumberList(QObject *parent) : ListProxy(parent) {
|
||||||
mustBeInMainThread(getClassName());
|
mustBeInMainThread(getClassName());
|
||||||
|
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||||
App::postModelAsync([=]() {
|
App::postModelAsync([=]() {
|
||||||
// Model thread.
|
// Model thread.
|
||||||
auto dialPlans = linphone::Factory::get()->getDialPlans();
|
auto dialPlans = linphone::Factory::get()->getDialPlans();
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ QSharedPointer<MagicSearchList> MagicSearchList::create() {
|
||||||
|
|
||||||
MagicSearchList::MagicSearchList(QObject *parent) : ListProxy(parent) {
|
MagicSearchList::MagicSearchList(QObject *parent) : ListProxy(parent) {
|
||||||
mustBeInMainThread(getClassName());
|
mustBeInMainThread(getClassName());
|
||||||
|
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||||
mSourceFlags = (int)linphone::MagicSearch::Source::Friends | (int)linphone::MagicSearch::Source::LdapServers;
|
mSourceFlags = (int)linphone::MagicSearch::Source::Friends | (int)linphone::MagicSearch::Source::LdapServers;
|
||||||
mAggregationFlag = LinphoneEnums::MagicSearchAggregation::Friend;
|
mAggregationFlag = LinphoneEnums::MagicSearchAggregation::Friend;
|
||||||
mSearchFilter = "*";
|
mSearchFilter = "*";
|
||||||
|
|
|
||||||
|
|
@ -43,17 +43,25 @@ void MagicSearchProxy::setList(QSharedPointer<MagicSearchList> newList) {
|
||||||
}
|
}
|
||||||
mList = newList;
|
mList = newList;
|
||||||
if (mList) {
|
if (mList) {
|
||||||
connect(mList.get(), &MagicSearchList::sourceFlagsChanged, this, &MagicSearchProxy::sourceFlagsChanged);
|
connect(mList.get(), &MagicSearchList::sourceFlagsChanged, this, &MagicSearchProxy::sourceFlagsChanged,
|
||||||
connect(mList.get(), &MagicSearchList::aggregationFlagChanged, this, &MagicSearchProxy::aggregationFlagChanged);
|
Qt::QueuedConnection);
|
||||||
connect(mList.get(), &MagicSearchList::friendCreated, this, [this](int index) {
|
connect(mList.get(), &MagicSearchList::aggregationFlagChanged, this, &MagicSearchProxy::aggregationFlagChanged,
|
||||||
auto proxyIndex = mapFromSource(sourceModel()->index(index, 0));
|
Qt::QueuedConnection);
|
||||||
emit friendCreated(proxyIndex.row());
|
connect(
|
||||||
});
|
mList.get(), &MagicSearchList::friendCreated, this,
|
||||||
connect(mList.get(), &MagicSearchList::initialized, this, [this, newList = mList.get()] {
|
[this](int index) {
|
||||||
emit newList->lSetSourceFlags(mSourceFlags);
|
auto proxyIndex = mapFromSource(sourceModel()->index(index, 0));
|
||||||
emit newList->lSetAggregationFlag(mAggregationFlag);
|
emit friendCreated(proxyIndex.row());
|
||||||
emit initialized();
|
},
|
||||||
});
|
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());
|
setSourceModel(mList.get());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ QSharedPointer<TimeZoneList> TimeZoneList::create() {
|
||||||
}
|
}
|
||||||
|
|
||||||
TimeZoneList::TimeZoneList(QObject *parent) : ListProxy(parent) {
|
TimeZoneList::TimeZoneList(QObject *parent) : ListProxy(parent) {
|
||||||
|
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
|
||||||
initTimeZones();
|
initTimeZones();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue