Skip to content
Snippets Groups Projects
Commit c20410d9 authored by Fatih Uzunoğlu's avatar Fatih Uzunoğlu Committed by Steve Lhomme
Browse files

qt: clear pointers before the target objects are freed in compositor_dcomp

This is a measure to prevent potential dangling pointer dereference.
parent 59d6d2bd
No related branches found
No related tags found
1 merge request!5733qt: clear pointers before the target objects are freed in compositor_dcomp
Pipeline #493267 passed with stage
in 29 minutes and 18 seconds
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment