surface: fix double wl_buffer.release events

Prior to this commit, we re-uploaded the buffer even if a new one
wasn't attached. After uploading, we send wl_buffer.release. So,
this sequence of requests resulted in a double release:

    surface.attach(buffer, 0, 0)
    surface.commit()
    <- buffer.release()
    surface.commit()
    <- buffer.release()
master
emersion 7 years ago
parent fb118ac996
commit 843621714f
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

@ -325,8 +325,7 @@ static void surface_damage_subsurfaces(struct wlr_subsurface *subsurface) {
}
}
static void surface_apply_damage(struct wlr_surface *surface,
bool invalid_buffer) {
static void surface_apply_damage(struct wlr_surface *surface) {
struct wl_resource *resource = surface->current->buffer;
if (resource == NULL) {
// NULL commit
@ -335,12 +334,6 @@ static void surface_apply_damage(struct wlr_surface *surface,
return;
}
if (surface->buffer != NULL && !surface->buffer->released &&
!invalid_buffer) {
// The buffer is still the same, no need to re-upload
return;
}
if (surface->buffer != NULL && surface->buffer->released) {
pixman_region32_t damage;
pixman_region32_init(&damage);
@ -376,7 +369,9 @@ static void surface_commit_pending(struct wlr_surface *surface) {
surface_move_state(surface, surface->pending, surface->current);
surface_apply_damage(surface, invalid_buffer);
if (invalid_buffer) {
surface_apply_damage(surface);
}
// commit subsurface order
struct wlr_subsurface *subsurface;

Loading…
Cancel
Save