diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-26 14:31:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-26 14:31:35 +0200 |
commit | 93ebd33aa8458401cc70d6146556b67839882276 (patch) | |
tree | a07b862310c62a0c1c9bd62338f025a4ba7be8a7 | |
parent | ce64bb7d83d2ddc2c125fc05edc0028d8caa1ec7 (diff) | |
parent | d81f0170a323d64b17461bfba5fd6e437e44dd89 (diff) |
Merge pull request #890 from agx/layer-shell-empty-output-crash
layer-shell: Fix crash when cursor is intially outside any output
-rw-r--r-- | rootston/layer_shell.c | 14 | ||||
-rw-r--r-- | types/wlr_layer_shell.c | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c index 836deb42..db0aeb59 100644 --- a/rootston/layer_shell.c +++ b/rootston/layer_shell.c @@ -395,8 +395,18 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { wlr_output_layout_output_at(desktop->layout, seat->cursor->cursor->x, seat->cursor->cursor->y); - assert(output); // And this one - layer_surface->output = output; + if (!output) { + wlr_log(L_ERROR, "Couldn't find output at (%.0f,%.0f)", + seat->cursor->cursor->x, + seat->cursor->cursor->y); + output = wlr_output_layout_get_center_output(desktop->layout); + } + if (output) { + layer_surface->output = output; + } else { + wlr_layer_surface_close(layer_surface); + return; + } } roots_surface->surface_commit.notify = handle_surface_commit; diff --git a/types/wlr_layer_shell.c b/types/wlr_layer_shell.c index 1fd0977b..676ed06d 100644 --- a/types/wlr_layer_shell.c +++ b/types/wlr_layer_shell.c @@ -288,7 +288,9 @@ static void handle_surface_committed(struct wlr_surface *wlr_surface, surface->added = true; wlr_signal_emit_safe(&surface->shell->events.new_surface, surface); - assert(surface->output); + // either the compositor found a suitable output or it must + // have closed the surface + assert(surface->output || surface->closed); } if (surface->configured && wlr_surface_has_buffer(surface->surface) && !surface->mapped) { |