Skip to content

Commit

Permalink
fix: sway crashes if switch to another workspace with surface when IM…
Browse files Browse the repository at this point in the history
…E popup is shown

in pr #8196, when im_popup_surface is unmapped, author set the popup->relative to NULL, butt popup is still in popup groups, where assert the relative is not NULL, this cause the panic

Take the suggestion of Nefsen402, remove the line where set relative to
NULL, and add NULL check in scene_descriptor_destory
  • Loading branch information
Decodetalkers authored and Nefsen402 committed Oct 8, 2024
1 parent c90cb37 commit f855b08
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions sway/input/text_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ static void handle_im_popup_surface_unmap(struct wl_listener *listener, void *da
struct sway_input_popup *popup =
wl_container_of(listener, popup, popup_surface_unmap);

scene_descriptor_destroy(&popup->scene_tree->node, SWAY_SCENE_DESC_POPUP);
// relative should already be freed as it should be a child of the just unmapped scene
popup->desc.relative = NULL;

Expand Down
3 changes: 3 additions & 0 deletions sway/scene_descriptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ void *scene_descriptor_try_get(struct wlr_scene_node *node,
void scene_descriptor_destroy(struct wlr_scene_node *node,
enum sway_scene_descriptor_type type) {
struct scene_descriptor *desc = scene_node_get_descriptor(node, type);
if (!desc) {
return;
}
descriptor_destroy(desc);
}

Expand Down

0 comments on commit f855b08

Please sign in to comment.