[vlc-commits] [Git][videolan/vlc][master] qt: clear pointers before the target objects are freed in compositor_dcomp
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri Jul 19 06:12:33 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
c20410d9 by Fatih Uzunoglu at 2024-07-19T05:33:30+00:00
qt: clear pointers before the target objects are freed in compositor_dcomp
This is a measure to prevent potential dangling pointer dereference.
- - - - -
1 changed file:
- modules/gui/qt/maininterface/compositor_dcomp.cpp
Changes:
=====================================
modules/gui/qt/maininterface/compositor_dcomp.cpp
=====================================
@@ -378,6 +378,15 @@ bool CompositorDirectComposition::eventFilter(QObject *watched, QEvent *event)
// deleted by Qt itself)
m_rootVisual->RemoveVisual(m_uiVisual);
m_rootVisual.Reset();
+
+ // When the window receives the event `SurfaceAboutToBeDestroyed`,
+ // the RHI and the RHI swap chain are going to be destroyed.
+ // It should be noted that event filters receive events
+ // before the watched object receives them.
+ // Since these objects belong to Qt, we should clear them
+ // in order to prevent potential dangling pointer dereference:
+ m_dcompDevice = nullptr;
+ m_uiVisual = nullptr;
}
break;
default:
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c20410d990b381832645fb177bf7f8c959f4dc01
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c20410d990b381832645fb177bf7f8c959f4dc01
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list