diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 21:01:33 -0400 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-04-02 21:01:33 -0400 |
commit | 2c165e1288cbb60f5e677595e35f58a9c56c7010 (patch) | |
tree | 8dc7105631a62ce2635bb18cf26abea5d02e7837 /sway/tree/container.c | |
parent | cleanup split command handlers (diff) | |
download | sway-2c165e1288cbb60f5e677595e35f58a9c56c7010.tar.gz sway-2c165e1288cbb60f5e677595e35f58a9c56c7010.tar.zst sway-2c165e1288cbb60f5e677595e35f58a9c56c7010.zip |
fix more close segfaults
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 4db93ce8..8688edd6 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -112,10 +112,45 @@ static struct sway_container *_container_destroy(struct sway_container *cont) { | |||
112 | struct sway_container *container_destroy(struct sway_container *cont) { | 112 | struct sway_container *container_destroy(struct sway_container *cont) { |
113 | struct sway_container *parent = _container_destroy(cont); | 113 | struct sway_container *parent = _container_destroy(cont); |
114 | parent = container_reap_empty(parent); | 114 | parent = container_reap_empty(parent); |
115 | arrange_windows(&root_container, -1, -1); | ||
116 | return parent; | 115 | return parent; |
117 | } | 116 | } |
118 | 117 | ||
118 | static void container_close_func(struct sway_container *container, void *data) { | ||
119 | if (container->type == C_VIEW) { | ||
120 | view_close(container->sway_view); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | struct sway_container *container_close(struct sway_container *con) { | ||
125 | if (!sway_assert(con != NULL, "container_close called with a NULL container")) { | ||
126 | return NULL; | ||
127 | } | ||
128 | |||
129 | switch (con->type) { | ||
130 | case C_TYPES: | ||
131 | wlr_log(L_ERROR, "tried to close an invalid container"); | ||
132 | break; | ||
133 | case C_ROOT: | ||
134 | wlr_log(L_ERROR, "tried to close the root container"); | ||
135 | break; | ||
136 | case C_OUTPUT: | ||
137 | container_output_destroy(con); | ||
138 | break; | ||
139 | case C_WORKSPACE: | ||
140 | container_workspace_destroy(con); | ||
141 | break; | ||
142 | case C_CONTAINER: | ||
143 | container_for_each_descendant_dfs(con, container_close_func, NULL); | ||
144 | break; | ||
145 | case C_VIEW: | ||
146 | view_close(con->sway_view); | ||
147 | break; | ||
148 | |||
149 | } | ||
150 | |||
151 | return con->parent; | ||
152 | } | ||
153 | |||
119 | struct sway_container *container_output_create( | 154 | struct sway_container *container_output_create( |
120 | struct sway_output *sway_output) { | 155 | struct sway_output *sway_output) { |
121 | struct wlr_box size; | 156 | struct wlr_box size; |