[vlc-commits] qt: fix release order of QML components when using DirectComposition
Pierre Lamot
git at videolan.org
Mon May 25 13:56:38 CEST 2020
vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Wed May 20 16:26:55 2020 +0200| [6e0dd91a6196d5b1e58ff9ab63d43d2010364554] | committer: Pierre Lamot
qt: fix release order of QML components when using DirectComposition
Deleting QmlEngine before QML root item caused context property to be released
too early as they were attached to the QML engine
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6e0dd91a6196d5b1e58ff9ab63d43d2010364554
---
.../gui/qt/maininterface/compositor_dcomp_uisurface.cpp | 4 ++--
modules/gui/qt/maininterface/mainui.cpp | 14 +++++++-------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp b/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
index 173f38bea7..e973e17420 100644
--- a/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
+++ b/modules/gui/qt/maininterface/compositor_dcomp_uisurface.cpp
@@ -229,10 +229,10 @@ CompositorDCompositionUISurface::~CompositorDCompositionUISurface()
delete m_uiOffscreenSurface;
if (m_context)
delete m_context;
- if (m_qmlEngine)
- delete m_qmlEngine;
if (m_rootItem)
delete m_rootItem;
+ if (m_qmlEngine)
+ delete m_qmlEngine;
releaseSharedTexture();
}
diff --git a/modules/gui/qt/maininterface/mainui.cpp b/modules/gui/qt/maininterface/mainui.cpp
index 2b1c44ce38..4671e6f216 100644
--- a/modules/gui/qt/maininterface/mainui.cpp
+++ b/modules/gui/qt/maininterface/mainui.cpp
@@ -104,19 +104,19 @@ bool MainUI::setup(QQmlEngine* engine)
QQmlContext *rootCtx = engine->rootContext();
- rootCtx->setContextProperty( "history", new NavigationHistory(engine) );
+ rootCtx->setContextProperty( "history", new NavigationHistory(this) );
rootCtx->setContextProperty( "player", m_intf->p_sys->p_mainPlayerController );
- rootCtx->setContextProperty( "i18n", new I18n(engine) );
- rootCtx->setContextProperty( "mainctx", new QmlMainContext(m_intf, m_mainInterface, engine));
+ rootCtx->setContextProperty( "i18n", new I18n(this) );
+ rootCtx->setContextProperty( "mainctx", new QmlMainContext(m_intf, m_mainInterface, this));
rootCtx->setContextProperty( "mainInterface", m_mainInterface);
rootCtx->setContextProperty( "topWindow", m_mainInterface->windowHandle());
rootCtx->setContextProperty( "dialogProvider", DialogsProvider::getInstance());
- rootCtx->setContextProperty( "recentsMedias", new VLCRecentMediaModel( m_intf, engine ));
- rootCtx->setContextProperty( "settings", new Settings( m_intf, engine ));
- rootCtx->setContextProperty( "systemPalette", new SystemPalette(engine));
+ rootCtx->setContextProperty( "recentsMedias", new VLCRecentMediaModel( m_intf, this ));
+ rootCtx->setContextProperty( "settings", new Settings( m_intf, this ));
+ rootCtx->setContextProperty( "systemPalette", new SystemPalette(this));
if (m_hasMedialibrary)
- rootCtx->setContextProperty( "medialib", new MediaLib(m_intf, engine) );
+ rootCtx->setContextProperty( "medialib", new MediaLib(m_intf, this) );
else
rootCtx->setContextProperty( "medialib", nullptr );
More information about the vlc-commits
mailing list