diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-20 10:37:52 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-08-20 10:37:52 +1000 |
commit | e1955c5c08d4131fd5d3e2a91ec8af05c3117eca (patch) | |
tree | 34ada4f6dfb4362aa37e6221f01a0561cc43a569 | |
parent | a49e4b13bf16bda8f1877272e04935329bb682c2 (diff) | |
download | sway-e1955c5c08d4131fd5d3e2a91ec8af05c3117eca.tar.xz |
Fix crash when adding output
-rw-r--r-- | include/sway/tree/container.h | 6 | ||||
-rw-r--r-- | sway/tree/container.c | 3 | ||||
-rw-r--r-- | sway/tree/view.c | 6 |
3 files changed, 11 insertions, 4 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index e0cda17c..cd886cd0 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -351,6 +351,12 @@ bool container_is_floating_or_child(struct sway_container *container); */ bool container_is_fullscreen_or_child(struct sway_container *container); +/** + * Return the output which will be used for scale purposes. + * This is the most recently entered output. + */ +struct sway_output *container_get_effective_output(struct sway_container *con); + void container_discover_outputs(struct sway_container *con); #endif diff --git a/sway/tree/container.c b/sway/tree/container.c index b932925d..6ea0cc94 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -764,8 +764,7 @@ void container_damage_whole(struct sway_container *container) { * Return the output which will be used for scale purposes. * This is the most recently entered output. */ -static struct sway_output *container_get_effective_output( - struct sway_container *con) { +struct sway_output *container_get_effective_output(struct sway_container *con) { if (con->outputs->length == 0) { return NULL; } diff --git a/sway/tree/view.c b/sway/tree/view.c index 4abf1abb..2c0c1aa9 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -889,8 +889,10 @@ void view_add_mark(struct sway_view *view, char *mark) { static void update_marks_texture(struct sway_view *view, struct wlr_texture **texture, struct border_colors *class) { - struct sway_output *output = - view->swayc->outputs->items[view->swayc->outputs->length - 1]; + struct sway_output *output = container_get_effective_output(view->swayc); + if (!output) { + return; + } if (*texture) { wlr_texture_destroy(*texture); *texture = NULL; |