mirror of
https://github.com/swaywm/sway.git
synced 2026-04-03 07:15:39 -04:00
Revert "sway/tree: Simplify sway_node teardown"
This reverts commit e28e6484e8.
This change tried to remove nodes from all points of reference to allow
immediate destruction. However, it missed things like the children lists
cloned by transaction states of parent nodes.
Adding all that extra cleanup would not be in the spirit of a PR
claiming to simplify teardown. Let's wait for someone to come up with a
cleaner approach instead.
Fixes: https://github.com/swaywm/sway/pull/8738
This commit is contained in:
parent
0cd45d4ad2
commit
56f2db062d
16 changed files with 149 additions and 125 deletions
|
|
@ -2,7 +2,6 @@
|
|||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include "sway/desktop/transaction.h"
|
||||
#include "sway/ipc-server.h"
|
||||
#include "sway/layers.h"
|
||||
#include "sway/output.h"
|
||||
|
|
@ -236,7 +235,7 @@ static void output_evacuate(struct sway_output *output) {
|
|||
}
|
||||
|
||||
if (workspace_num_sticky_containers(workspace) == 0) {
|
||||
workspace_destroy(workspace);
|
||||
workspace_begin_destroy(workspace);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -254,6 +253,27 @@ static void output_evacuate(struct sway_output *output) {
|
|||
}
|
||||
}
|
||||
|
||||
void output_destroy(struct sway_output *output) {
|
||||
if (!sway_assert(output->node.destroying,
|
||||
"Tried to free output which wasn't marked as destroying")) {
|
||||
return;
|
||||
}
|
||||
if (!sway_assert(output->wlr_output == NULL,
|
||||
"Tried to free output which still had a wlr_output")) {
|
||||
return;
|
||||
}
|
||||
if (!sway_assert(output->node.ntxnrefs == 0, "Tried to free output "
|
||||
"which is still referenced by transactions")) {
|
||||
return;
|
||||
}
|
||||
|
||||
destroy_scene_layers(output);
|
||||
list_free(output->workspaces);
|
||||
list_free(output->current.workspaces);
|
||||
wlr_color_transform_unref(output->color_transform);
|
||||
free(output);
|
||||
}
|
||||
|
||||
void output_disable(struct sway_output *output) {
|
||||
if (!sway_assert(output->enabled, "Expected an enabled output")) {
|
||||
return;
|
||||
|
|
@ -275,24 +295,15 @@ void output_disable(struct sway_output *output) {
|
|||
output_evacuate(output);
|
||||
}
|
||||
|
||||
void output_destroy(struct sway_output *output) {
|
||||
void output_begin_destroy(struct sway_output *output) {
|
||||
if (!sway_assert(!output->enabled, "Expected a disabled output")) {
|
||||
return;
|
||||
}
|
||||
sway_log(SWAY_DEBUG, "Destroying output '%s'", output->wlr_output->name);
|
||||
wl_signal_emit_mutable(&output->node.events.destroy, &output->node);
|
||||
|
||||
transaction_remove_node(&output->node);
|
||||
|
||||
if (!sway_assert(output->node.ntxnrefs == 0, "Tried to free output "
|
||||
"which is still referenced by transactions")) {
|
||||
return;
|
||||
}
|
||||
|
||||
destroy_scene_layers(output);
|
||||
list_free(output->workspaces);
|
||||
list_free(output->current.workspaces);
|
||||
wlr_color_transform_unref(output->color_transform);
|
||||
free(output);
|
||||
output->node.destroying = true;
|
||||
node_set_dirty(&output->node);
|
||||
}
|
||||
|
||||
struct sway_output *output_from_wlr_output(struct wlr_output *output) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue