[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: fix stale connection remains valid in `TextureProviderObserver`
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Mon May 11 20:22:34 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
adef7959 by Fatih Uzunoglu at 2026-05-11T21:06:55+02:00
qt: fix stale connection remains valid in `TextureProviderObserver`
We were conditionally disconnecting from `m_source`,
because if we already captured its texture provider,
it would not be necessary since waiting for a valid
window for that reason is a single shot connection.
However with edd1a1e0, we have to listen window change
at all times, so we need to disconnect regardless of
whether we already captured the texture provider or
not.
Not doing this can result in assertion failure, since
`m_source` may become null while the connection is
valid because the old source may still be alive. It may
also cause unnecessarily calling
`::adjustSampleAndNotifyConnection()` if the new source
is not null but a different item.
It is good that we had the assertion there as otherwise
this would not be obvious.
- - - - -
67fe6e8a by Fatih Uzunoglu at 2026-05-11T21:06:55+02:00
qt: adjust old texture properties appropriately in `TextureProviderObserver`
We should update the old properties only if the texture is not dynamic
because only then we guarantee that we signal the changes (if the texture
is not dynamic, we signal all changes regardless of `notifyAllChanges`).
If texture is dynamic, we should not update the old properties even if
`notifyAllChanges` is `false` because if it turns `true` later on, the
change may not be signalled.
At the same time in `::resetProperties()`, we already decide that the
texture is not dynamic (`m_textureIsDynamic.exchange(false, memoryOrder)`),
so we do not need to have an if statement there checking for
`notifyAllChanges` or `isDynamic` as the branch would always be taken.
- - - - -
1 changed file:
- modules/gui/qt/util/textureproviderobserver.cpp
Changes:
=====================================
modules/gui/qt/util/textureproviderobserver.cpp
=====================================
@@ -49,6 +49,12 @@ void TextureProviderObserver::setSource(const QQuickItem *source, bool enforce)
if (m_source)
{
+ // Source changed before we got its `QSGTextureProvider`, but we need
+ // to do it regardless if we already captured the texture provider
+ // because we are now listening `::windowChanged()` at all times (no
+ // longer only a single shot connection):
+ disconnect(m_source, nullptr, this, nullptr);
+
if (Q_LIKELY(m_provider))
{
disconnect(m_provider, nullptr, this, nullptr);
@@ -60,11 +66,6 @@ void TextureProviderObserver::setSource(const QQuickItem *source, bool enforce)
// - There is no more source.
resetProperties(); // memory order does not matter, `setSource()` is not called frequently.
}
- else
- {
- // source changed before we got its `QSGTextureProvider`
- disconnect(m_source, nullptr, this, nullptr);
- }
}
m_source = source;
@@ -333,7 +334,7 @@ void TextureProviderObserver::updateProperties()
}
}
- if (!m_notifyAllChanges.load(memoryOrder) || !textureIsDynamic)
+ if (!textureIsDynamic)
{
m_oldTextureSize.store(textureSize, memoryOrder);
m_oldNativeTextureSize.store(nativeTextureSize, memoryOrder);
@@ -377,13 +378,10 @@ void TextureProviderObserver::resetProperties(std::memory_order memoryOrder)
if (m_comparisonKey.exchange(-1, memoryOrder) != -1)
emit comparisonKeyChanged(-1);
- if (!m_notifyAllChanges.load(memoryOrder) || !m_textureIsDynamic.load(memoryOrder))
- {
- m_oldTextureSize.store({}, memoryOrder);
- m_oldNativeTextureSize.store({}, memoryOrder);
- m_oldNormalizedTextureSubRect.store({}, memoryOrder);
- m_oldComparisonKey.store(-1, memoryOrder);
- }
+ m_oldTextureSize.store({}, memoryOrder);
+ m_oldNativeTextureSize.store({}, memoryOrder);
+ m_oldNormalizedTextureSubRect.store({}, memoryOrder);
+ m_oldComparisonKey.store(-1, memoryOrder);
}
void TextureProviderObserver::adjustSampleAndNotifyConnection()
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cadacd08c2bcf9050226c7c493fe823ae2672e5a...67fe6e8a4111157cc5d4d2ba9811314cc77f9fb6
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cadacd08c2bcf9050226c7c493fe823ae2672e5a...67fe6e8a4111157cc5d4d2ba9811314cc77f9fb6
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list