Skip to content

Fix deleting GraphicsBuffer twice

Vlad Zahorodnii requested to merge work/zzag/graphics-buffer-double-deleted into master

When GraphicsBuffer::dropped() is emitted, the buffer can be unreferenced. If that's the case, the GraphicsBuffer will be deleted twice: first in GraphicsBuffer::unref(), the second time in drop().

In order to address the issue, this change gets rid of the GraphicsBuffer::dropped() signal, so it's always guaranteed that the buffer stays alive until the reference count is checked.

The GraphicsBuffer::dropped() signal is used to remove the mapping between wl_resource and ShmClientBuffer when the corresponding wl_shm_buffer object is destroyed. On the other hand, we could perform such cleanup when calling drop() too. This code can be further improved by reimplementing wl-shm, which we need to do at some point in the future.

Edited by Vlad Zahorodnii

Merge request reports

Loading