[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: handle if provider is destroyed in `TextureProviderObserver`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Fri May 8 03:58:21 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
4912e62d by Fatih Uzunoglu at 2026-05-08T03:42:41+00:00
qt: handle if provider is destroyed in `TextureProviderObserver`
This is very unlikely, but still better to have it.
- - - - -
b40fef60 by Fatih Uzunoglu at 2026-05-08T03:42:41+00:00
qt: add note regarding source texture provider in `TextureProviderIndirection`
- - - - -
3 changed files:
- modules/gui/qt/util/textureproviderindirection.hpp
- modules/gui/qt/util/textureproviderobserver.cpp
- modules/gui/qt/util/textureproviderobserver.hpp
Changes:
=====================================
modules/gui/qt/util/textureproviderindirection.hpp
=====================================
@@ -57,6 +57,8 @@ class TextureProviderIndirection : public QQuickItem
{
Q_OBJECT
+ // NOTE: source must be a texture provider item.
+ // NOTE: If source's texture provider changes, it is required to re-set the property.
Q_PROPERTY(const QQuickItem* source MEMBER m_source NOTIFY sourceChanged FINAL)
// NOTE: Although this is named as `textureSubRect`, it is allowed to provide a larger size than
// the texture size. In that case, the texture's wrap mode is going to be relevant, provided
=====================================
modules/gui/qt/util/textureproviderobserver.cpp
=====================================
@@ -129,6 +129,14 @@ void TextureProviderObserver::setSource(const QQuickItem *source, bool enforce)
connect(m_provider, &QSGTextureProvider::textureChanged, this, &TextureProviderObserver::updateProperties, Qt::DirectConnection);
+ // `QQuickItem` does not signal if it would have a new texture provider, so we simply set the source to null instead.
+ // We probably don't need to do the same for `m_source`, because if it is destroyed, the property should be updated
+ // instead, which in QML side is assumed to be done implicitly. Note that this is unlikely and no item does that,
+ // but it is still better to have this:
+ connect(m_provider, &QObject::destroyed, this, [this]() {
+ setSource(nullptr); // This also implicitly calls `resetProperties()`.
+ });
+
updateProperties();
}, static_cast<Qt::ConnectionType>(Qt::SingleShotConnection | Qt::DirectConnection));
};
=====================================
modules/gui/qt/util/textureproviderobserver.hpp
=====================================
@@ -33,6 +33,7 @@ class TextureProviderObserver : public QObject
Q_OBJECT
// NOTE: source must be a texture provider item.
+ // NOTE: If source's texture provider changes, it is required to re-set the property.
Q_PROPERTY(const QQuickItem* source MEMBER m_source WRITE setSource NOTIFY sourceChanged FINAL)
// WARNING: Texture properties are updated in the rendering thread.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/32d35ba1caf94055b98465555d591abe6bfb4390...b40fef60bb042165f96d48be67f476cbf99c84a4
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/32d35ba1caf94055b98465555d591abe6bfb4390...b40fef60bb042165f96d48be67f476cbf99c84a4
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list