Skip to content

Commit 1e8ece8

Browse files
committed
feat: keep last non-null buffer for content
Keep last non-null buffer for WSurfaceItemContent until explicitly destroyed.
1 parent 656e0ca commit 1e8ece8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/server/qtquick/wsurfaceitem.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ class Q_DECL_HIDDEN WSurfaceItemContentPrivate: public QQuickItemPrivate
195195

196196
Q_ASSERT(!updateTextureConnection);
197197
updateTextureConnection = surface->safeConnect(&WSurface::bufferChanged, q, [q, this] {
198+
// WSurfaceItemContent is for displaying content. When buffer is null, the surface is unmapped.
199+
// There is no need for WSurfaceItemContent to reset its buffer to null. It should keep the last
200+
// non-null buffer until explicitly destroyed. So we directly return when surface's buffer is null.
201+
if (!surface->buffer() && dontCacheLastBuffer)
202+
return;
198203
if (!live) {
199204
pendingBuffer.reset(surface->buffer());
200205
if (pendingBuffer)

0 commit comments

Comments
 (0)