Fix memory leak in handle_layer_shell_surface

This commit is contained in:
frsfnrrg 2018-07-17 11:21:32 -04:00
parent 600676688a
commit 37471ac649
1 changed files with 6 additions and 6 deletions

View File

@ -325,12 +325,6 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
layer_surface->client_pending.margin.bottom,
layer_surface->client_pending.margin.left);
struct sway_layer_surface *sway_layer =
calloc(1, sizeof(struct sway_layer_surface));
if (!sway_layer) {
return;
}
if (!layer_surface->output) {
// Assign last active output
struct sway_container *output = NULL;
@ -352,6 +346,12 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) {
layer_surface->output = output->sway_output->wlr_output;
}
struct sway_layer_surface *sway_layer =
calloc(1, sizeof(struct sway_layer_surface));
if (!sway_layer) {
return;
}
sway_layer->surface_commit.notify = handle_surface_commit;
wl_signal_add(&layer_surface->surface->events.commit,
&sway_layer->surface_commit);