aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-23 17:47:28 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-23 17:47:28 +1000
commit32b865e610dd937af17ce36b8c986e41f55a4627 (patch)
treebb89819988dcebe0d621c645fac35c9bfe4198d4 /sway/desktop/output.c
parentMerge remote-tracking branch 'upstream/master' into atomic (diff)
downloadsway-32b865e610dd937af17ce36b8c986e41f55a4627.tar.gz
sway-32b865e610dd937af17ce36b8c986e41f55a4627.tar.zst
sway-32b865e610dd937af17ce36b8c986e41f55a4627.zip
Fix crash when deleting last child in a tabbed or stacked container
There was no `current` child because the container was destroyed. This makes it fall back to looking in the parent's current children list.
Diffstat (limited to 'sway/desktop/output.c')
-rw-r--r--sway/desktop/output.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 9db95ef5..1ca48975 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -713,7 +713,7 @@ static void render_container_tabbed(struct sway_output *output,
713 } 713 }
714 struct sway_seat *seat = input_manager_current_seat(input_manager); 714 struct sway_seat *seat = input_manager_current_seat(input_manager);
715 struct sway_container *focus = seat_get_focus(seat); 715 struct sway_container *focus = seat_get_focus(seat);
716 struct sway_container *current = seat_get_active_child(seat, con); 716 struct sway_container *current = seat_get_active_current_child(seat, con);
717 struct border_colors *current_colors = NULL; 717 struct border_colors *current_colors = NULL;
718 struct sway_container_state *pstate = &con->current; 718 struct sway_container_state *pstate = &con->current;
719 719
@@ -756,11 +756,13 @@ static void render_container_tabbed(struct sway_output *output,
756 } 756 }
757 757
758 // Render surface and left/right/bottom borders 758 // Render surface and left/right/bottom borders
759 if (current->type == C_VIEW) { 759 if (current) {
760 render_view(output, damage, current, current_colors); 760 if (current->type == C_VIEW) {
761 } else { 761 render_view(output, damage, current, current_colors);
762 render_container(output, damage, current, 762 } else {
763 parent_focused || current == focus); 763 render_container(output, damage, current,
764 parent_focused || current == focus);
765 }
764 } 766 }
765} 767}
766 768
@@ -775,7 +777,7 @@ static void render_container_stacked(struct sway_output *output,
775 } 777 }
776 struct sway_seat *seat = input_manager_current_seat(input_manager); 778 struct sway_seat *seat = input_manager_current_seat(input_manager);
777 struct sway_container *focus = seat_get_focus(seat); 779 struct sway_container *focus = seat_get_focus(seat);
778 struct sway_container *current = seat_get_active_child(seat, con); 780 struct sway_container *current = seat_get_active_current_child(seat, con);
779 struct border_colors *current_colors = NULL; 781 struct border_colors *current_colors = NULL;
780 struct sway_container_state *pstate = &con->current; 782 struct sway_container_state *pstate = &con->current;
781 783
@@ -812,11 +814,13 @@ static void render_container_stacked(struct sway_output *output,
812 } 814 }
813 815
814 // Render surface and left/right/bottom borders 816 // Render surface and left/right/bottom borders
815 if (current->type == C_VIEW) { 817 if (current) {
816 render_view(output, damage, current, current_colors); 818 if (current->type == C_VIEW) {
817 } else { 819 render_view(output, damage, current, current_colors);
818 render_container(output, damage, current, 820 } else {
819 parent_focused || current == focus); 821 render_container(output, damage, current,
822 parent_focused || current == focus);
823 }
820 } 824 }
821} 825}
822 826