mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
- Fix crash when quitting the application by stopping core before destructors and by adding a check in ChatRoomModel destructor.
This commit is contained in:
parent
0591d882af
commit
ecf6c9dfd1
3 changed files with 24 additions and 13 deletions
|
|
@ -23,6 +23,8 @@
|
|||
#ifdef QT_QML_DEBUG
|
||||
#include <QQmlDebuggingEnabler>
|
||||
#endif
|
||||
|
||||
#include "components/core/CoreManager.hpp"
|
||||
// =============================================================================
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
|
|
@ -45,5 +47,9 @@ int main (int argc, char *argv[]) {
|
|||
app->initContentApp();
|
||||
ret = app->exec();
|
||||
} while (ret == App::RestartCode);
|
||||
auto core = CoreManager::getInstance()->getCore();
|
||||
if(core && core->getGlobalState() == linphone::GlobalState::On)
|
||||
core->stop();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,11 +64,14 @@ CameraPreview::CameraPreview (QQuickItem *parent) : QQuickFramebufferObject(pare
|
|||
}
|
||||
|
||||
CameraPreview::~CameraPreview () {
|
||||
mCounterMutex.lock();
|
||||
if (--mCounter == 0)
|
||||
CoreManager::getInstance()->getCore()->enableVideoPreview(false);
|
||||
mCounterMutex.unlock();
|
||||
CoreManager::getInstance()->getCore()->setNativePreviewWindowId(NULL);
|
||||
auto core = CoreManager::getInstance()->getCore();
|
||||
if(core){
|
||||
mCounterMutex.lock();
|
||||
if (--mCounter == 0)
|
||||
core->enableVideoPreview(false);
|
||||
mCounterMutex.unlock();
|
||||
core->setNativePreviewWindowId(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
class SafeFramebuffer : public QQuickFramebufferObject::Renderer{
|
||||
|
|
|
|||
|
|
@ -248,17 +248,19 @@ ChatRoomModel::ChatRoomModel (std::shared_ptr<linphone::ChatRoom> chatRoom, QObj
|
|||
|
||||
ChatRoomModel::~ChatRoomModel () {
|
||||
mParticipantListModel = nullptr;
|
||||
if(mChatRoom){
|
||||
if(mChatRoom ){
|
||||
mChatRoom->removeListener(mChatRoomModelListener);
|
||||
if(mDeleteChatRoom){
|
||||
mDeleteChatRoom = false;
|
||||
auto participants = mChatRoom->getParticipants();
|
||||
std::list<std::shared_ptr<linphone::Address>> participantsAddress;
|
||||
for(auto p : participants)
|
||||
participantsAddress.push_back(p->getAddress()->clone());
|
||||
auto internalChatRoom = CoreManager::getInstance()->getCore()->searchChatRoom(mChatRoom->getCurrentParams(), mChatRoom->getLocalAddress(), mChatRoom->getPeerAddress(), participantsAddress);
|
||||
if( internalChatRoom)
|
||||
CoreManager::getInstance()->getCore()->deleteChatRoom(internalChatRoom);
|
||||
if(CoreManager::getInstance()->getCore() ){
|
||||
auto participants = mChatRoom->getParticipants();
|
||||
std::list<std::shared_ptr<linphone::Address>> participantsAddress;
|
||||
for(auto p : participants)
|
||||
participantsAddress.push_back(p->getAddress()->clone());
|
||||
auto internalChatRoom = CoreManager::getInstance()->getCore()->searchChatRoom(mChatRoom->getCurrentParams(), mChatRoom->getLocalAddress(), mChatRoom->getPeerAddress(), participantsAddress);
|
||||
if( internalChatRoom)
|
||||
CoreManager::getInstance()->getCore()->deleteChatRoom(internalChatRoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
mChatRoom = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue