mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-01 03:19:23 +00:00
Protect setting window ID in camera when core or call are not usable.
This commit is contained in:
parent
fc6d5b79c4
commit
c8458433e9
1 changed files with 7 additions and 6 deletions
|
|
@ -68,16 +68,17 @@ Camera::~Camera(){
|
|||
}
|
||||
|
||||
void Camera::resetWindowId() const{
|
||||
if(mIsWindowIdSet){
|
||||
auto core = CoreManager::getInstance()->getCore();
|
||||
if(core && mIsWindowIdSet){
|
||||
QQuickFramebufferObject::Renderer * oldRenderer = NULL;
|
||||
if(mWindowIdLocation == CorePreview){
|
||||
oldRenderer = (QQuickFramebufferObject::Renderer *)CoreManager::getInstance()->getCore()->getNativePreviewWindowId();
|
||||
oldRenderer = (QQuickFramebufferObject::Renderer *)core->getNativePreviewWindowId();
|
||||
if(oldRenderer)
|
||||
CoreManager::getInstance()->getCore()->setNativePreviewWindowId(NULL);
|
||||
core->setNativePreviewWindowId(NULL);
|
||||
}else if( mWindowIdLocation == Call){
|
||||
if(mCallModel){
|
||||
auto call = mCallModel->getCall();
|
||||
if( call ){
|
||||
if( call && call->getState() != linphone::Call::State::End && call->getState() != linphone::Call::State::Released){
|
||||
oldRenderer = (QQuickFramebufferObject::Renderer *) call->getNativeVideoWindowId();
|
||||
if(oldRenderer)
|
||||
call->setNativeVideoWindowId(NULL);
|
||||
|
|
@ -93,9 +94,9 @@ void Camera::resetWindowId() const{
|
|||
}
|
||||
}
|
||||
}else if( mWindowIdLocation == Core){
|
||||
oldRenderer = (QQuickFramebufferObject::Renderer *)CoreManager::getInstance()->getCore()->getNativeVideoWindowId();
|
||||
oldRenderer = (QQuickFramebufferObject::Renderer *)core->getNativeVideoWindowId();
|
||||
if(oldRenderer)
|
||||
CoreManager::getInstance()->getCore()->setNativeVideoWindowId(NULL);
|
||||
core->setNativeVideoWindowId(NULL);
|
||||
}
|
||||
qDebug() << "[Camera] Removed " << oldRenderer << " at " << mWindowIdLocation << " for " << this;
|
||||
mIsWindowIdSet = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue