From 1667b78b4bd912d473b138451b4e0c8a5586b15a Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 24 Mar 2022 16:40:29 +0100 Subject: [PATCH] Fix crashs on video call. - do deleteLater on QObjects. - Queued QQuickFramebufferObject updates. - Clean Linphone SDK window ID on Camera deletion (Qml side, it cannot be done on C++ beacause of asynchroneous signals). - Do cleaning synchronization between calls window and fullscreen. - Avoid to rebuild all entries of ChatRoom when below minimum limits (keep this feature to avoid loading time when initiate the call). --- .../single-application/SingleApplication.cpp | 12 +-- .../src/components/calls/CallsListModel.cpp | 4 +- linphone-app/src/components/camera/Camera.cpp | 11 ++- linphone-app/src/components/camera/Camera.hpp | 2 + .../components/chat-room/ChatRoomModel.cpp | 74 +++++++++++-------- .../components/chat-room/ChatRoomModel.hpp | 3 +- .../chat-room/ChatRoomProxyModel.cpp | 45 ++++++----- .../contacts/ContactsImporterModel.cpp | 4 +- .../ContactsImporterPluginsManager.cpp | 2 +- .../components/contacts/ContactsListModel.cpp | 2 +- .../src/components/core/CoreManager.cpp | 4 +- .../src/components/ldap/LdapListModel.cpp | 2 +- .../src/components/notifier/Notifier.cpp | 2 +- .../ParticipantImdnStateProxyModel.cpp | 4 +- .../settings/AccountSettingsModel.cpp | 23 ++++-- .../settings/AccountSettingsModel.hpp | 33 ++++++--- .../src/components/timeline/TimelineModel.cpp | 3 +- .../src/utils/hacks/ChatRoomInitializer.cpp | 4 +- .../src/utils/plugins/PluginsManager.cpp | 6 +- .../ui/modules/Common/Form/ActionButton.qml | 3 +- linphone-app/ui/views/App/Calls/Incall.js | 23 ++++-- linphone-app/ui/views/App/Calls/Incall.qml | 24 ++++-- .../App/Calls/IncallFullscreenWindow.qml | 12 ++- .../ui/views/App/Main/Conversation.qml | 2 +- linphone-sdk | 2 +- 25 files changed, 190 insertions(+), 116 deletions(-) diff --git a/linphone-app/src/app/single-application/SingleApplication.cpp b/linphone-app/src/app/single-application/SingleApplication.cpp index 195f64837..1cdb724d9 100644 --- a/linphone-app/src/app/single-application/SingleApplication.cpp +++ b/linphone-app/src/app/single-application/SingleApplication.cpp @@ -69,17 +69,17 @@ SingleApplicationPrivate::SingleApplicationPrivate (SingleApplication *p_ptr) : SingleApplicationPrivate::~SingleApplicationPrivate () { if (socket != nullptr) { socket->close(); - delete socket; + socket->deleteLater(); } memory->lock(); InstancesInfo *inst = static_cast(memory->data()); if (server != nullptr) { server->close(); - delete server; + server->deleteLater(); inst->primary = false; } memory->unlock(); - delete memory; + memory->deleteLater(); } void SingleApplicationPrivate::genBlockServerName (int timeout) { @@ -276,7 +276,7 @@ void SingleApplicationPrivate::slotConnectionEstablished () { if (connectionType == InvalidConnection) { nextConnSocket->close(); - delete nextConnSocket; + nextConnSocket->deleteLater(); return; } @@ -376,7 +376,7 @@ SingleApplication::SingleApplication (int &argc, char *argv[], bool allowSeconda } d->connectToPrimary(timeout, NewInstance); - delete d; + d->deleteLater(); ::exit(EXIT_SUCCESS); } @@ -385,7 +385,7 @@ SingleApplication::SingleApplication (int &argc, char *argv[], bool allowSeconda */ SingleApplication::~SingleApplication () { Q_D(SingleApplication); - delete d; + d->deleteLater(); } bool SingleApplication::isPrimary () { diff --git a/linphone-app/src/components/calls/CallsListModel.cpp b/linphone-app/src/components/calls/CallsListModel.cpp index f46805fef..b303f0f01 100644 --- a/linphone-app/src/components/calls/CallsListModel.cpp +++ b/linphone-app/src/components/calls/CallsListModel.cpp @@ -141,7 +141,7 @@ void CallsListModel::launchAudioCall (const QString &sipAddress, const QString& [address,core,params,currentProxyConfig,prepareTransfertAddress, context](const std::shared_ptr &proxyConfig, linphone::RegistrationState state) mutable { if(context && proxyConfig==currentProxyConfig && state==linphone::RegistrationState::Ok){ CallModel::prepareTransfert(core->inviteAddressWithParams(address, params), prepareTransfertAddress); - delete context; + context->deleteLater(); context = nullptr; } }); @@ -179,7 +179,7 @@ void CallsListModel::launchSecureAudioCall (const QString &sipAddress, LinphoneE [address,core,params,currentProxyConfig,prepareTransfertAddress, context](const std::shared_ptr &proxyConfig, linphone::RegistrationState state) mutable { if(context && proxyConfig==currentProxyConfig && state==linphone::RegistrationState::Ok){ CallModel::prepareTransfert(core->inviteAddressWithParams(address, params), prepareTransfertAddress); - delete context; + context->deleteLater(); context = nullptr; } }); diff --git a/linphone-app/src/components/camera/Camera.cpp b/linphone-app/src/components/camera/Camera.cpp index 184e4d85c..58120c136 100644 --- a/linphone-app/src/components/camera/Camera.cpp +++ b/linphone-app/src/components/camera/Camera.cpp @@ -48,12 +48,21 @@ Camera::Camera (QQuickItem *parent) : QQuickFramebufferObject(parent) { QObject::connect( mRefreshTimer, &QTimer::timeout, this, &QQuickFramebufferObject::update, - Qt::DirectConnection + Qt::QueuedConnection ); mRefreshTimer->start(); } +void Camera::resetWindowId() { + if(mIsPreview) + CoreManager::getInstance()->getCore()->setNativePreviewWindowId(NULL); + else if( mCallModel && mCallModel->getCall()) + mCallModel->getCall()->setNativeVideoWindowId(NULL); + else + CoreManager::getInstance()->getCore()->setNativeVideoWindowId(NULL); +} + class SafeFramebuffer : public QQuickFramebufferObject::Renderer{ public: SafeFramebuffer(){} diff --git a/linphone-app/src/components/camera/Camera.hpp b/linphone-app/src/components/camera/Camera.hpp index 1feab0488..d52f5f956 100644 --- a/linphone-app/src/components/camera/Camera.hpp +++ b/linphone-app/src/components/camera/Camera.hpp @@ -46,6 +46,8 @@ public: Camera (QQuickItem *parent = Q_NULLPTR); QQuickFramebufferObject::Renderer *createRenderer () const override; + + Q_INVOKABLE void resetWindowId(); signals: void callChanged (CallModel *callModel); diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.cpp b/linphone-app/src/components/chat-room/ChatRoomModel.cpp index f34cbccac..2dd47fed7 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.cpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.cpp @@ -921,41 +921,51 @@ int ChatRoomModel::loadTillMessage(ChatMessageModel * message){ return -1; } -void ChatRoomModel::initEntries(){ - qDebug() << "Internal Entries : Init"; -// On call : reinitialize all entries. This allow to free up memory - QList > entries; - QList prepareEntries; -// Get chat messages - for (auto &message : mChatRoom->getHistory(mFirstLastEntriesStep)) { - prepareEntries << EntrySorterHelper(message->getTime() ,MessageEntry, message); - } -// Get events - for(auto &eventLog : mChatRoom->getHistoryEvents(mFirstLastEntriesStep)) - prepareEntries << EntrySorterHelper(eventLog->getCreationTime() , NoticeEntry, eventLog); -// Get calls. - bool secureChatEnabled = CoreManager::getInstance()->getSettingsModel()->getSecureChatEnabled(); - bool standardChatEnabled = CoreManager::getInstance()->getSettingsModel()->getStandardChatEnabled(); +void ChatRoomModel::resetEntries(){ + beginResetModel(); + mEntries.clear(); + endResetModel(); +} - if( isOneToOne() && (secureChatEnabled && !standardChatEnabled && isSecure() - || standardChatEnabled && !isSecure()) ) { - auto callHistory = CallsListModel::getCallHistory(getParticipantAddress(), Utils::coreStringToAppString(mChatRoom->getLocalAddress()->asStringUriOnly())); - // callhistory is sorted from newest to oldest - int count = 0; - for (auto callLog = callHistory.begin() ; count < mFirstLastEntriesStep && callLog != callHistory.end() ; ++callLog, ++count ){ - prepareEntries << EntrySorterHelper((*callLog)->getStartDate(), CallEntry, *callLog); +void ChatRoomModel::initEntries(){ + if( mEntries.size() > mLastEntriesStep) + resetEntries(); + if(mEntries.size() == 0) { + qDebug() << "Internal Entries : Init"; + // On call : reinitialize all entries. This allow to free up memory + QList > entries; + QList prepareEntries; + // Get chat messages + for (auto &message : mChatRoom->getHistory(mFirstLastEntriesStep)) { + prepareEntries << EntrySorterHelper(message->getTime() ,MessageEntry, message); } + // Get events + for(auto &eventLog : mChatRoom->getHistoryEvents(mFirstLastEntriesStep)) + prepareEntries << EntrySorterHelper(eventLog->getCreationTime() , NoticeEntry, eventLog); + // Get calls. + bool secureChatEnabled = CoreManager::getInstance()->getSettingsModel()->getSecureChatEnabled(); + bool standardChatEnabled = CoreManager::getInstance()->getSettingsModel()->getStandardChatEnabled(); + + if( isOneToOne() && (secureChatEnabled && !standardChatEnabled && isSecure() + || standardChatEnabled && !isSecure()) ) { + auto callHistory = CallsListModel::getCallHistory(getParticipantAddress(), Utils::coreStringToAppString(mChatRoom->getLocalAddress()->asStringUriOnly())); + // callhistory is sorted from newest to oldest + int count = 0; + for (auto callLog = callHistory.begin() ; count < mFirstLastEntriesStep && callLog != callHistory.end() ; ++callLog, ++count ){ + prepareEntries << EntrySorterHelper((*callLog)->getStartDate(), CallEntry, *callLog); + } + } + EntrySorterHelper::getLimitedSelection(&entries, prepareEntries, mFirstLastEntriesStep, this); + qDebug() << "Internal Entries : Built"; + mIsInitialized = true; + if(entries.size() >0){ + beginInsertRows(QModelIndex(),0, entries.size()-1); + mEntries = entries; + updateNewMessageNotice(mChatRoom->getUnreadMessagesCount()); + endInsertRows(); + } + qDebug() << "Internal Entries : End"; } - EntrySorterHelper::getLimitedSelection(&entries, prepareEntries, mFirstLastEntriesStep, this); - qDebug() << "Internal Entries : Built"; - mIsInitialized = true; - if(entries.size() >0){ - beginResetModel(); - mEntries = entries; - updateNewMessageNotice(mChatRoom->getUnreadMessagesCount()); - endResetModel(); - } - qDebug() << "Internal Entries : End"; } void ChatRoomModel::setEntriesLoading(const bool& loading){ if( mEntriesLoading != loading){ diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.hpp b/linphone-app/src/components/chat-room/ChatRoomModel.hpp index 573f022e9..03c74b85e 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.hpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.hpp @@ -231,7 +231,8 @@ public: Q_INVOKABLE void forwardMessage(ChatMessageModel * model); void compose (); Q_INVOKABLE void resetMessageCount (); - Q_INVOKABLE void initEntries(); + Q_INVOKABLE void resetEntries(); + void initEntries(); Q_INVOKABLE int loadMoreEntries(); // return new entries count void callEnded(std::shared_ptr call); void updateNewMessageNotice(const int& count); diff --git a/linphone-app/src/components/chat-room/ChatRoomProxyModel.cpp b/linphone-app/src/components/chat-room/ChatRoomProxyModel.cpp index fe2a6bc4d..ec7940754 100644 --- a/linphone-app/src/components/chat-room/ChatRoomProxyModel.cpp +++ b/linphone-app/src/components/chat-room/ChatRoomProxyModel.cpp @@ -246,30 +246,29 @@ QString ChatRoomProxyModel::getCachedText() const{ // ----------------------------------------------------------------------------- void ChatRoomProxyModel::reload (ChatRoomModel *chatRoomModel) { - - if (mChatRoomModel) { - ChatRoomModel *ChatRoomModel = mChatRoomModel.get(); - QObject::disconnect(ChatRoomModel, &ChatRoomModel::isRemoteComposingChanged, this, &ChatRoomProxyModel::handleIsRemoteComposingChanged); - QObject::disconnect(ChatRoomModel, &ChatRoomModel::messageReceived, this, &ChatRoomProxyModel::handleMessageReceived); - QObject::disconnect(ChatRoomModel, &ChatRoomModel::messageSent, this, &ChatRoomProxyModel::handleMessageSent); - QObject::disconnect(ChatRoomModel, &ChatRoomModel::markAsReadEnabledChanged, this, &ChatRoomProxyModel::markAsReadEnabledChanged); - QObject::disconnect(ChatRoomModel, &ChatRoomModel::moreEntriesLoaded, this, &ChatRoomProxyModel::onMoreEntriesLoaded); + if(chatRoomModel != mChatRoomModel.get()) { + if (mChatRoomModel) { + ChatRoomModel *ChatRoomModel = mChatRoomModel.get(); + QObject::disconnect(ChatRoomModel, &ChatRoomModel::isRemoteComposingChanged, this, &ChatRoomProxyModel::handleIsRemoteComposingChanged); + QObject::disconnect(ChatRoomModel, &ChatRoomModel::messageReceived, this, &ChatRoomProxyModel::handleMessageReceived); + QObject::disconnect(ChatRoomModel, &ChatRoomModel::messageSent, this, &ChatRoomProxyModel::handleMessageSent); + QObject::disconnect(ChatRoomModel, &ChatRoomModel::markAsReadEnabledChanged, this, &ChatRoomProxyModel::markAsReadEnabledChanged); + QObject::disconnect(ChatRoomModel, &ChatRoomModel::moreEntriesLoaded, this, &ChatRoomProxyModel::onMoreEntriesLoaded); + } + mChatRoomModel = CoreManager::getInstance()->getTimelineListModel()->getChatRoomModel(chatRoomModel); + setSourceModel(mChatRoomModel.get()); + if (mChatRoomModel) { + + ChatRoomModel *ChatRoomModel = mChatRoomModel.get(); + QObject::connect(ChatRoomModel, &ChatRoomModel::isRemoteComposingChanged, this, &ChatRoomProxyModel::handleIsRemoteComposingChanged); + QObject::connect(ChatRoomModel, &ChatRoomModel::messageReceived, this, &ChatRoomProxyModel::handleMessageReceived); + QObject::connect(ChatRoomModel, &ChatRoomModel::messageSent, this, &ChatRoomProxyModel::handleMessageSent); + QObject::connect(ChatRoomModel, &ChatRoomModel::markAsReadEnabledChanged, this, &ChatRoomProxyModel::markAsReadEnabledChanged); + QObject::connect(ChatRoomModel, &ChatRoomModel::moreEntriesLoaded, this, &ChatRoomProxyModel::onMoreEntriesLoaded); + mChatRoomModel->initEntries();// This way, we don't load huge chat rooms (that lead to freeze GUI) + } } - - mChatRoomModel = CoreManager::getInstance()->getTimelineListModel()->getChatRoomModel(chatRoomModel); - - if (mChatRoomModel) { - - ChatRoomModel *ChatRoomModel = mChatRoomModel.get(); - QObject::connect(ChatRoomModel, &ChatRoomModel::isRemoteComposingChanged, this, &ChatRoomProxyModel::handleIsRemoteComposingChanged); - QObject::connect(ChatRoomModel, &ChatRoomModel::messageReceived, this, &ChatRoomProxyModel::handleMessageReceived); - QObject::connect(ChatRoomModel, &ChatRoomModel::messageSent, this, &ChatRoomProxyModel::handleMessageSent); - QObject::connect(ChatRoomModel, &ChatRoomModel::markAsReadEnabledChanged, this, &ChatRoomProxyModel::markAsReadEnabledChanged); - QObject::connect(ChatRoomModel, &ChatRoomModel::moreEntriesLoaded, this, &ChatRoomProxyModel::onMoreEntriesLoaded); - mChatRoomModel->initEntries();// This way, we don't load huge chat rooms (that lead to freeze GUI) - } - setSourceModel(mChatRoomModel.get()); - invalidate(); + //invalidate(); } void ChatRoomProxyModel::resetMessageCount(){ diff --git a/linphone-app/src/components/contacts/ContactsImporterModel.cpp b/linphone-app/src/components/contacts/ContactsImporterModel.cpp index 6fc1ec3de..fcaa5b94a 100644 --- a/linphone-app/src/components/contacts/ContactsImporterModel.cpp +++ b/linphone-app/src/components/contacts/ContactsImporterModel.cpp @@ -44,10 +44,10 @@ ContactsImporterModel::ContactsImporterModel (PluginDataAPI * data, QObject *par void ContactsImporterModel::setDataAPI(PluginDataAPI *data){ if(mData){// Unload the current plugin loader and delete it from memory QPluginLoader * loader = mData->getPluginLoader(); - delete mData; + mData->deleteLater(); if(loader){ loader->unload(); - delete loader; + loader->deleteLater(); } mData = data; }else diff --git a/linphone-app/src/components/contacts/ContactsImporterPluginsManager.cpp b/linphone-app/src/components/contacts/ContactsImporterPluginsManager.cpp index 91c026bcd..b820986d1 100644 --- a/linphone-app/src/components/contacts/ContactsImporterPluginsManager.cpp +++ b/linphone-app/src/components/contacts/ContactsImporterPluginsManager.cpp @@ -112,6 +112,6 @@ void ContactsImporterPluginsManager::importContacts(const QVectorgetSipAddresses().size()>0){ CoreManager::getInstance()->getContactsListModel()->addContact(card); }else - delete card; + card->deleteLater(); } } diff --git a/linphone-app/src/components/contacts/ContactsListModel.cpp b/linphone-app/src/components/contacts/ContactsListModel.cpp index a456d15d1..523e6a748 100644 --- a/linphone-app/src/components/contacts/ContactsListModel.cpp +++ b/linphone-app/src/components/contacts/ContactsListModel.cpp @@ -148,7 +148,7 @@ ContactModel *ContactsListModel::addContact (VcardModel *vcardModel) { if (mLinphoneFriends->addFriend(contact->mLinphoneFriend) != linphone::FriendList::Status::OK) { qWarning() << QStringLiteral("Unable to add contact from vcard:") << vcardModel; - delete contact; + contact->deleteLater(); return nullptr; } diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index a21a333a4..39611c6c0 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -186,8 +186,8 @@ void CoreManager::stateChanged(Qt::ApplicationState pState){ if(pState == Qt::ApplicationActive) mCbsTimer->setInterval( Constants::CbsCallInterval); else - mCbsTimer->setInterval( Constants::CbsCallInterval * 10); - } + mCbsTimer->setInterval( Constants::CbsCallInterval * 2);// Reduce a little processes + } } // ----------------------------------------------------------------------------- diff --git a/linphone-app/src/components/ldap/LdapListModel.cpp b/linphone-app/src/components/ldap/LdapListModel.cpp index 9c3cc9678..528fbcbba 100644 --- a/linphone-app/src/components/ldap/LdapListModel.cpp +++ b/linphone-app/src/components/ldap/LdapListModel.cpp @@ -83,7 +83,7 @@ bool LdapListModel::removeRows (int row, int count, const QModelIndex &parent) { beginRemoveRows(parent, row, limit); for (int i = 0; i < count; ++i) - delete mServers.takeAt(row); + mServers.takeAt(row)->deleteLater(); endRemoveRows(); diff --git a/linphone-app/src/components/notifier/Notifier.cpp b/linphone-app/src/components/notifier/Notifier.cpp index 9bcf5315e..0cb88350b 100644 --- a/linphone-app/src/components/notifier/Notifier.cpp +++ b/linphone-app/src/components/notifier/Notifier.cpp @@ -114,7 +114,7 @@ Notifier::~Notifier () { const int nComponents = Notifications.size(); for (int i = 0; i < nComponents; ++i) - delete mComponents[i]; + mComponents[i]->deleteLater(); delete[] mComponents; } diff --git a/linphone-app/src/components/participant-imdn/ParticipantImdnStateProxyModel.cpp b/linphone-app/src/components/participant-imdn/ParticipantImdnStateProxyModel.cpp index a4c34304c..23a5d84aa 100644 --- a/linphone-app/src/components/participant-imdn/ParticipantImdnStateProxyModel.cpp +++ b/linphone-app/src/components/participant-imdn/ParticipantImdnStateProxyModel.cpp @@ -66,6 +66,8 @@ void ParticipantImdnStateProxyModel::setChatMessageModel(ChatMessageModel * mess ParticipantImdnStateListModel *model = static_cast(sourceModel()); ParticipantImdnStateListModel *messageModel = message->getParticipantImdnStates().get(); if( model != messageModel){ + if(model) + disconnect(model, &ParticipantImdnStateListModel::countChanged, this, &ParticipantImdnStateProxyModel::countChanged); setSourceModel(messageModel); connect(messageModel, &ParticipantImdnStateListModel::countChanged, this, &ParticipantImdnStateProxyModel::countChanged); sort(0); @@ -73,4 +75,4 @@ void ParticipantImdnStateProxyModel::setChatMessageModel(ChatMessageModel * mess } } emit chatMessageModelChanged(); -} \ No newline at end of file +} diff --git a/linphone-app/src/components/settings/AccountSettingsModel.cpp b/linphone-app/src/components/settings/AccountSettingsModel.cpp index 4fb322e08..26f4aea6c 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.cpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.cpp @@ -62,7 +62,17 @@ AccountSettingsModel::AccountSettingsModel (QObject *parent) : QObject(parent) { coreManager->getHandlers().get(), &CoreHandlers::registrationStateChanged, this, &AccountSettingsModel::handleRegistrationStateChanged ); - QObject::connect(coreManager, &CoreManager::eventCountChanged, this, [this]() { emit accountSettingsUpdated(); }); + //QObject::connect(coreManager, &CoreManager::eventCountChanged, this, [this]() { emit accountSettingsUpdated(); }); + + QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::usernameChanged); + QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::sipAddressChanged); + QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::fullSipAddressChanged); + QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::registrationStateChanged); + QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::conferenceURIChanged); + QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::primaryDisplayNameChanged); + QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::primaryUsernameChanged); + QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::primarySipAddressChanged); + QObject::connect(this, &AccountSettingsModel::accountSettingsUpdated, this, &AccountSettingsModel::accountsChanged); } // ----------------------------------------------------------------------------- @@ -79,6 +89,7 @@ void AccountSettingsModel::setUsedSipAddress (const shared_ptr proxyConfig = core->getDefaultProxyConfig(); proxyConfig ? proxyConfig->setIdentityAddress(address) : core->setPrimaryContact(address->asString()); + emit sipAddressChanged(); } QString AccountSettingsModel::getUsedSipAddressAsStringUriOnly () const { @@ -404,7 +415,7 @@ void AccountSettingsModel::setUsername (const QString &username) { .arg(Utils::coreStringToAppString(newAddress->asStringUriOnly())); } else { setUsedSipAddress(newAddress); - emit accountSettingsUpdated(); + emit usernameChanged(); } } } @@ -432,7 +443,7 @@ void AccountSettingsModel::setPrimaryUsername (const QString &username) { username.isEmpty() ? APPLICATION_NAME : username )); core->setPrimaryContact(primary->asString()); - emit accountSettingsUpdated(); + emit primaryUsernameChanged(); } } @@ -448,7 +459,7 @@ void AccountSettingsModel::setPrimaryDisplayName (const QString &displayName) { if(oldDisplayName != displayName){ primary->setDisplayName(Utils::appStringToCoreString(displayName)); core->setPrimaryContact(primary->asString()); - emit accountSettingsUpdated(); + emit primaryDisplayNameChanged(); } } @@ -508,10 +519,10 @@ void AccountSettingsModel::handleRegistrationStateChanged ( mRemovingProxies.removeAll(proxy); QTimer::singleShot(100, [proxy, this](){// removeProxyConfig cannot be called from callback CoreManager::getInstance()->getCore()->removeProxyConfig(proxy); - emit accountSettingsUpdated(); + emit accountsChanged(); }); } if(defaultProxyConfig == proxy) emit defaultRegistrationChanged(); - emit accountSettingsUpdated(); + emit registrationStateChanged(); } diff --git a/linphone-app/src/components/settings/AccountSettingsModel.hpp b/linphone-app/src/components/settings/AccountSettingsModel.hpp index e509e0864..48f2a67ba 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.hpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.hpp @@ -34,19 +34,19 @@ class AccountSettingsModel : public QObject { Q_OBJECT // Selected proxy config. - Q_PROPERTY(QString username READ getUsername WRITE setUsername NOTIFY accountSettingsUpdated) - Q_PROPERTY(QString sipAddress READ getUsedSipAddressAsStringUriOnly NOTIFY accountSettingsUpdated) - Q_PROPERTY(QString fullSipAddress READ getUsedSipAddressAsString) - Q_PROPERTY(RegistrationState registrationState READ getRegistrationState NOTIFY accountSettingsUpdated) + Q_PROPERTY(QString username READ getUsername WRITE setUsername NOTIFY usernameChanged) + Q_PROPERTY(QString sipAddress READ getUsedSipAddressAsStringUriOnly NOTIFY sipAddressChanged) + Q_PROPERTY(QString fullSipAddress READ getUsedSipAddressAsString NOTIFY fullSipAddressChanged) + Q_PROPERTY(RegistrationState registrationState READ getRegistrationState NOTIFY registrationStateChanged) - Q_PROPERTY(QString conferenceURI READ getConferenceURI NOTIFY accountSettingsUpdated) + Q_PROPERTY(QString conferenceURI READ getConferenceURI NOTIFY conferenceURIChanged) // Default info. - Q_PROPERTY(QString primaryDisplayName READ getPrimaryDisplayName WRITE setPrimaryDisplayName NOTIFY accountSettingsUpdated) - Q_PROPERTY(QString primaryUsername READ getPrimaryUsername WRITE setPrimaryUsername NOTIFY accountSettingsUpdated) - Q_PROPERTY(QString primarySipAddress READ getPrimarySipAddress NOTIFY accountSettingsUpdated) + Q_PROPERTY(QString primaryDisplayName READ getPrimaryDisplayName WRITE setPrimaryDisplayName NOTIFY primaryDisplayNameChanged) + Q_PROPERTY(QString primaryUsername READ getPrimaryUsername WRITE setPrimaryUsername NOTIFY primaryUsernameChanged) + Q_PROPERTY(QString primarySipAddress READ getPrimarySipAddress NOTIFY primarySipAddressChanged) - Q_PROPERTY(QVariantList accounts READ getAccounts NOTIFY accountSettingsUpdated) + Q_PROPERTY(QVariantList accounts READ getAccounts NOTIFY accountsChanged) public: enum RegistrationState { @@ -88,6 +88,21 @@ public: Q_INVOKABLE void eraseAllPasswords (); signals: + + void usernameChanged(); + void sipAddressChanged(); + void fullSipAddressChanged(); + void registrationStateChanged(); + void conferenceURIChanged(); + + void primaryDisplayNameChanged(); + void primaryUsernameChanged(); + void primarySipAddressChanged(); + + void accountsChanged(); + + + void accountSettingsUpdated (); void defaultProxyChanged(); void publishPresenceChanged(); diff --git a/linphone-app/src/components/timeline/TimelineModel.cpp b/linphone-app/src/components/timeline/TimelineModel.cpp index 82492ab50..66f59a866 100644 --- a/linphone-app/src/components/timeline/TimelineModel.cpp +++ b/linphone-app/src/components/timeline/TimelineModel.cpp @@ -131,7 +131,8 @@ void TimelineModel::setSelected(const bool& selected){ << ", canHandleParticipants:"<< mChatRoomModel->canHandleParticipants() << ", isReadOnly:" << mChatRoomModel->isReadOnly() << ", state:" << mChatRoomModel->getState(); - } + }else + mChatRoomModel->resetEntries();// Cleanup leaving chat room emit selectedChanged(mSelected); } } diff --git a/linphone-app/src/utils/hacks/ChatRoomInitializer.cpp b/linphone-app/src/utils/hacks/ChatRoomInitializer.cpp index 9732c9f13..523568dad 100644 --- a/linphone-app/src/utils/hacks/ChatRoomInitializer.cpp +++ b/linphone-app/src/utils/hacks/ChatRoomInitializer.cpp @@ -67,9 +67,9 @@ void ChatRoomInitializer::setAdminsAsync(const std::string& subject, const linph init->mAdmins = admins; init->mSelf = init; chatRoomEvent->addListener(init); - delete context; + context->deleteLater(); }else if( state > linphone::ChatRoom::State::Created){// The chat room could be completed. Delete the bind. - delete context; + context->deleteLater(); } } }); diff --git a/linphone-app/src/utils/plugins/PluginsManager.cpp b/linphone-app/src/utils/plugins/PluginsManager.cpp index 3ed134814..43b513da0 100644 --- a/linphone-app/src/utils/plugins/PluginsManager.cpp +++ b/linphone-app/src/utils/plugins/PluginsManager.cpp @@ -66,7 +66,7 @@ QPluginLoader * PluginsManager::getPlugin(const QString &pluginIdentity){ loader->unload(); } } - delete loader; + loader->deleteLater(); } } return nullptr; @@ -93,7 +93,7 @@ void * PluginsManager::createInstance(const QString &pluginIdentity){ }else loader->unload(); } - delete loader; + loader->deleteLater(); } } return dataInstance; @@ -111,7 +111,7 @@ QJsonDocument PluginsManager::getJson(const QString &pluginIdentity){ } } pluginLoader->unload(); - delete pluginLoader; + pluginLoader->deleteLater(); } return doc; } diff --git a/linphone-app/ui/modules/Common/Form/ActionButton.qml b/linphone-app/ui/modules/Common/Form/ActionButton.qml index 9bb2281cd..1d456b5cb 100644 --- a/linphone-app/ui/modules/Common/Form/ActionButton.qml +++ b/linphone-app/ui/modules/Common/Form/ActionButton.qml @@ -256,7 +256,6 @@ Item { visible: !isCustom } - OpacityMask{ anchors.fill: foregroundColor source: foregroundColor @@ -264,7 +263,6 @@ Item { visible: isCustom } - OpacityMask{ id: mask anchors.fill: foregroundHiddenPartColor @@ -273,6 +271,7 @@ Item { visible: isCustom && percentageDisplayed != 100 } + MouseArea{ anchors.fill:parent hoverEnabled: true diff --git a/linphone-app/ui/views/App/Calls/Incall.js b/linphone-app/ui/views/App/Calls/Incall.js index 3520ce343..7f0b778eb 100644 --- a/linphone-app/ui/views/App/Calls/Incall.js +++ b/linphone-app/ui/views/App/Calls/Incall.js @@ -131,18 +131,25 @@ function openMediaParameters (window, incall) { } function showFullscreen (position) { + incall.isFullScreen = true if (incall._fullscreen) { incall._fullscreen.raise() return } DesktopTools.DesktopTools.screenSaverStatus = false - incall._fullscreen = Utils.openWindow(Qt.resolvedUrl('IncallFullscreenWindow.qml'), window, { - properties: { - caller: incall, - x:position.x, - y:position.y, - width:window.width, - height:window.height - } + var parameters = { + caller: incall, + x:position.x, + y:position.y, + width:window.width, + height:window.height, + window:window + } + incall._fullscreen = Utils.openWindow(Qt.resolvedUrl('IncallFullscreenWindow.qml'), parameters.window, { + properties: parameters }, true) + if(incall._fullscreen) { + incall._fullscreen.cameraIsReady = Qt.binding(function(){ return !incall.cameraIsReady}) + incall._fullscreen.previewIsReady = Qt.binding(function(){ return !incall.previewIsReady}) + } } diff --git a/linphone-app/ui/views/App/Calls/Incall.qml b/linphone-app/ui/views/App/Calls/Incall.qml index 99f2f1c4e..fb65c15a8 100644 --- a/linphone-app/ui/views/App/Calls/Incall.qml +++ b/linphone-app/ui/views/App/Calls/Incall.qml @@ -21,15 +21,18 @@ Rectangle { // --------------------------------------------------------------------------- // Used by `IncallFullscreenWindow.qml`. - readonly property bool cameraActivated: - cameraLoader.status !== Loader.Null || - cameraPreviewLoader.status !== Loader.Null + readonly property bool cameraActivated: cameraIsReady || previewIsReady + + property bool cameraIsReady : false + property bool previewIsReady : false property var call property var _sipAddressObserver: SipAddressesModel.getSipAddressObserver(call.fullPeerAddress, call.fullLocalAddress) - property var _fullscreen: null + property bool isFullScreen: false // Use this variable to test if we are in fullscreen. Do not test _fullscreen : we need to clean memory before having the window (see .js file) + property var _fullscreen: null + on_FullscreenChanged: if( !_fullscreen) isFullScreen = false // --------------------------------------------------------------------------- color: CallStyle.backgroundColor @@ -246,7 +249,7 @@ Rectangle { anchors.centerIn: parent - active: incall.call.videoEnabled && !_fullscreen + active: incall.call.videoEnabled && !isFullScreen sourceComponent: camera Component { @@ -256,14 +259,18 @@ Rectangle { call: incall.call height: container.height width: container.width + Component.onDestruction: { + resetWindowId() + } } + } } Loader { anchors.centerIn: parent - active: !call.videoEnabled || _fullscreen + active: !call.videoEnabled || isFullScreen sourceComponent: avatar } } @@ -388,7 +395,7 @@ Rectangle { anchors.centerIn: parent height: CallStyle.actionArea.userVideo.height width: CallStyle.actionArea.userVideo.width - active: incall.width >= CallStyle.actionArea.lowWidth && incall.call.videoEnabled && !_fullscreen + active: incall.width >= CallStyle.actionArea.lowWidth && incall.call.videoEnabled && !isFullScreen sourceComponent: cameraPreview Component { id: cameraPreview @@ -397,6 +404,9 @@ Rectangle { anchors.fill: parent call: incall.call isPreview: true + Component.onDestruction: { + resetWindowId() + } } } } diff --git a/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml b/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml index 87093d03d..55aaad0dc 100644 --- a/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml +++ b/linphone-app/ui/views/App/Calls/IncallFullscreenWindow.qml @@ -24,6 +24,8 @@ Window { property var call property var caller property bool hideButtons: false + property bool cameraIsReady : false + property bool previewIsReady : false // --------------------------------------------------------------------------- @@ -72,7 +74,7 @@ Window { active: { var caller = window.caller - return caller && !caller.cameraActivated + return window.cameraIsReady && caller && !caller.cameraActivated } sourceComponent: camera @@ -82,6 +84,9 @@ Window { Camera { call: window.call + Component.onDestruction: { + resetWindowId() + } } } } @@ -430,7 +435,7 @@ Window { Loader { active: { var caller = window.caller - return caller && !caller.cameraActivated + return window.previewIsReady && caller && !caller.cameraActivated } sourceComponent: cameraPreview @@ -457,6 +462,9 @@ Window { call: window.call isPreview: true + Component.onDestruction: { + resetWindowId() + } height: Math.min(window.height, (CallFullscreenStyle.actionArea.userVideo.height * window.height/CallFullscreenStyle.actionArea.userVideo.heightReference) * scale) width: Math.min(window.width, (CallFullscreenStyle.actionArea.userVideo.width * window.width/CallFullscreenStyle.actionArea.userVideo.widthReference) * scale ) diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index 0c5bb190c..f36af48ae 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -554,7 +554,7 @@ ColumnLayout { Connections { target: AccountSettingsModel - onAccountSettingsUpdated: { + onSipAddressChanged: { if (conversation.localAddress !== AccountSettingsModel.sipAddress) { window.setView('Home') } diff --git a/linphone-sdk b/linphone-sdk index 340bc9a1a..00fd2d08b 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit 340bc9a1a682cfb5feb4751280e1b94693ee0ce1 +Subproject commit 00fd2d08b3cc24365aba7407c3885e11cc120024