aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/render.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-04-02 11:53:56 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-04-02 11:53:56 -0400
commitc507727ad240b978c6e09e3aa9238080ca9a1c81 (patch)
tree2ef131d4798845e972b3350fa816cc2ea0bca8e1 /swaybar/render.c
parentSend click events for i3bar blocks (diff)
downloadsway-c507727ad240b978c6e09e3aa9238080ca9a1c81.tar.gz
sway-c507727ad240b978c6e09e3aa9238080ca9a1c81.tar.zst
sway-c507727ad240b978c6e09e3aa9238080ca9a1c81.zip
Fix use-after-free with block hotspots
Diffstat (limited to 'swaybar/render.c')
-rw-r--r--swaybar/render.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/swaybar/render.c b/swaybar/render.c
index a5039a2e..a62e1d01 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -153,7 +153,7 @@ static uint32_t render_status_block(cairo_t *cairo,
153 hotspot->width = width; 153 hotspot->width = width;
154 hotspot->height = height; 154 hotspot->height = height;
155 hotspot->callback = block_hotspot_callback; 155 hotspot->callback = block_hotspot_callback;
156 hotspot->destroy = free; 156 hotspot->destroy = NULL;
157 hotspot->data = block; 157 hotspot->data = block;
158 wl_list_insert(&output->hotspots, &hotspot->link); 158 wl_list_insert(&output->hotspots, &hotspot->link);
159 159
@@ -227,9 +227,9 @@ static uint32_t render_status_line_i3bar(cairo_t *cairo,
227 struct swaybar_config *config, struct swaybar_output *output, 227 struct swaybar_config *config, struct swaybar_output *output,
228 struct status_line *status, bool focused, 228 struct status_line *status, bool focused,
229 double *x, uint32_t width, uint32_t height) { 229 double *x, uint32_t width, uint32_t height) {
230 struct i3bar_block *block;
231 uint32_t max_height = 0; 230 uint32_t max_height = 0;
232 bool edge = true; 231 bool edge = true;
232 struct i3bar_block *block;
233 wl_list_for_each_reverse(block, &status->blocks, link) { 233 wl_list_for_each_reverse(block, &status->blocks, link) {
234 uint32_t h = render_status_block(cairo, config, output, 234 uint32_t h = render_status_block(cairo, config, output,
235 block, x, height, focused, edge); 235 block, x, height, focused, edge);
@@ -376,6 +376,7 @@ static uint32_t render_workspace_button(cairo_t *cairo,
376static uint32_t render_to_cairo(cairo_t *cairo, 376static uint32_t render_to_cairo(cairo_t *cairo,
377 struct swaybar *bar, struct swaybar_output *output) { 377 struct swaybar *bar, struct swaybar_output *output) {
378 struct swaybar_config *config = bar->config; 378 struct swaybar_config *config = bar->config;
379 wlr_log(L_DEBUG, "output %p", output);
379 380
380 cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE); 381 cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE);
381 if (output->focused) { 382 if (output->focused) {