[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: fix window destroyed before the vout window in Wayland compositor
François Cartegnie (@fcartegnie)
gitlab at videolan.org
Fri Aug 30 06:27:05 UTC 2024
François Cartegnie pushed to branch master at VideoLAN / VLC
Commits:
6923be9b by Pierre Lamot at 2024-08-30T06:11:32+00:00
qt: fix window destroyed before the vout window in Wayland compositor
fix: #28760
- - - - -
f7e0e6df by Pierre Lamot at 2024-08-30T06:11:32+00:00
qt: update compositor documentation
- - - - -
2 changed files:
- modules/gui/qt/maininterface/compositor.hpp
- modules/gui/qt/maininterface/compositor_wayland.cpp
Changes:
=====================================
modules/gui/qt/maininterface/compositor.hpp
=====================================
@@ -72,8 +72,22 @@ public:
[[nodiscard]] virtual bool init() = 0;
[[nodiscard]] virtual bool makeMainInterface(MainCtx* intf) = 0;
+
+ /**
+ * @brief destroyMainInterface must released all resources, this is called before
+ * destroying the compositor
+ */
virtual void destroyMainInterface() = 0;
+ /**
+ * @brief unloadGUI must destroy the resources associated to the UI part,
+ * this includes QML resources.
+ * Resources that are dependencies of the video surfaces should not be
+ * destroyed as the video window may be destroyed after the interface.
+ *
+ * this means that if your video depends on a QQuickView, you must unload
+ * the QML content but keep the QQuickView
+ */
virtual void unloadGUI() = 0;
[[nodiscard]] virtual bool setupVoutWindow(vlc_window_t *p_wnd, VoutDestroyCb destroyCb) = 0;
@@ -131,9 +145,23 @@ protected:
bool setBlurBehind(QWindow* window, bool enable = true);
protected:
+ /**
+ * @brief commonGUICreate setup the QML view for video composition
+ * this should be called from makeMainInterface specialisation
+ */
bool commonGUICreate(QWindow* window, QmlUISurface* , CompositorVideo::Flags flags);
bool commonGUICreate(QWindow* window, QQuickView* , CompositorVideo::Flags flags);
+
+ /**
+ * @brief commonIntfDestroy release GUI resources allocated by commonGUICreate
+ * this should be called from unloadGUI specialisation
+ */
void commonGUIDestroy();
+
+ /**
+ * @brief commonIntfDestroy release interface resources allocated by commonGUICreate
+ * this should be called from destroyMainInterface specialisation
+ */
void commonIntfDestroy();
private:
=====================================
modules/gui/qt/maininterface/compositor_wayland.cpp
=====================================
@@ -151,6 +151,7 @@ QWindow* CompositorWayland::interfaceMainWindow() const
void CompositorWayland::destroyMainInterface()
{
unloadGUI();
+ m_qmlView.reset();
}
void CompositorWayland::unloadGUI()
@@ -158,7 +159,12 @@ void CompositorWayland::unloadGUI()
//needs to be released before the window
m_interfaceWindowHandler.reset();
- m_qmlView.reset();
+ //at this point we need to unload the QML content but the window still need to
+ //be valid as it may still be used by the vout window.
+ //we cant' just delete the qmlEngine as the QmlView as the root item is parented to the QmlView
+ //setSource() to nothing will effectively destroy the root item
+ m_qmlView->setSource(QUrl());
+
commonGUIDestroy();
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5fa2f2d8b76f59c633c15d69b83f4cd8e0a7d189...f7e0e6df14f5f577268055ecf553f613315e3274
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5fa2f2d8b76f59c633c15d69b83f4cd8e0a7d189...f7e0e6df14f5f577268055ecf553f613315e3274
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