diff options
author | 2023-10-24 15:24:51 +0300 | |
---|---|---|
committer | 2023-10-24 14:35:57 +0200 | |
commit | 47263aca289ab4d89ba69a543357603e64719ff6 (patch) | |
tree | 1d98ec32e74521be86e606ce5813de8c2efa9710 | |
parent | config/output: Allow approximation of output refresh rate (diff) | |
download | sway-47263aca289ab4d89ba69a543357603e64719ff6.tar.gz sway-47263aca289ab4d89ba69a543357603e64719ff6.tar.zst sway-47263aca289ab4d89ba69a543357603e64719ff6.zip |
view: check if the buffer was uploaded on save
wlr_surface_has_buffer() is insufficient; if a client has committed a
buffer but it couldn't be applied, NULL deref happens in the next line.
-rw-r--r-- | sway/tree/view.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index ec54fed8..a9035de7 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -1422,7 +1422,7 @@ static void view_save_buffer_iterator(struct wlr_surface *surface, | |||
1422 | int sx, int sy, void *data) { | 1422 | int sx, int sy, void *data) { |
1423 | struct sway_view *view = data; | 1423 | struct sway_view *view = data; |
1424 | 1424 | ||
1425 | if (surface && wlr_surface_has_buffer(surface)) { | 1425 | if (surface && surface->buffer) { |
1426 | wlr_buffer_lock(&surface->buffer->base); | 1426 | wlr_buffer_lock(&surface->buffer->base); |
1427 | struct sway_saved_buffer *saved_buffer = calloc(1, sizeof(struct sway_saved_buffer)); | 1427 | struct sway_saved_buffer *saved_buffer = calloc(1, sizeof(struct sway_saved_buffer)); |
1428 | saved_buffer->buffer = surface->buffer; | 1428 | saved_buffer->buffer = surface->buffer; |