[vlc-commits] [Git][videolan/vlc][master] qt: do not delete QObject from potentially different thread
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sat Aug 17 08:31:54 UTC 2024
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
e61bab77 by Fatih Uzunoglu at 2024-08-17T08:10:42+00:00
qt: do not delete QObject from potentially different thread
In 2b0471c, a change was made to delete video surface provider
and video window handler when video window is destroyed. This
makes sense, since they are not necessary anymore (so no need
to keep them in memory) and also the connections would cease
to exist automatically.
However, turns out that this method may be called from a
different thread than the one these objects belong to.
Considering the following quote from Qt documentation, do not
delete them here but instead simply disconnect the signals.
> You must not delete the QObject directly if it exists in a
> different thread than the one currently executing.
- - - - -
1 changed file:
- modules/gui/qt/maininterface/compositor.cpp
Changes:
=====================================
modules/gui/qt/maininterface/compositor.cpp
=====================================
@@ -212,11 +212,16 @@ void CompositorVideo::commonSetupVoutWindow(vlc_window_t* p_wnd, VoutDestroyCb d
void CompositorVideo::windowDestroy()
{
+ // Current thread may not be the thread where
+ // m_videoSurfaceProvider belongs to, so do not delete
+ // it here:
+ disconnect(m_videoSurfaceProvider.get(), &VideoSurfaceProvider::surfacePositionChanged,
+ this, &CompositorVideo::onSurfacePositionChanged);
+ disconnect(m_videoSurfaceProvider.get(), &VideoSurfaceProvider::surfaceSizeChanged,
+ this, &CompositorVideo::onSurfaceSizeChanged);
+
if (m_destroyCb)
m_destroyCb(m_wnd);
-
- m_videoSurfaceProvider.reset();
- m_videoWindowHandler.reset();
}
void CompositorVideo::windowResize(unsigned width, unsigned height)
@@ -323,6 +328,8 @@ void CompositorVideo::commonGUIDestroy()
void CompositorVideo::commonIntfDestroy()
{
+ m_videoWindowHandler.reset();
+ m_videoSurfaceProvider.reset();
unloadGUI();
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e61bab777f0f063575e63cb78de981697576192b
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/e61bab777f0f063575e63cb78de981697576192b
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