mirror of
https://github.com/swaywm/sway.git
synced 2026-04-26 06:46:26 -04:00
view_from_wlr_xwayland_surface(): fix miscasting of types
The existing code works by accident because the "view" field (of type sway_view) just happens to be the first field in the sway_xwayland_view struct. Depending on that is error-prone; all it takes is a simple reordering of fields in that struct to trigger a nonlocal bug. Adding the correct casting sequence will ensure that reodering fields won't cause problems.
This commit is contained in:
parent
d19f4f7bf8
commit
4dad33fa95
1 changed files with 1 additions and 1 deletions
|
|
@ -574,7 +574,7 @@ static void handle_set_hints(struct wl_listener *listener, void *data) {
|
||||||
|
|
||||||
struct sway_view *view_from_wlr_xwayland_surface(
|
struct sway_view *view_from_wlr_xwayland_surface(
|
||||||
struct wlr_xwayland_surface *xsurface) {
|
struct wlr_xwayland_surface *xsurface) {
|
||||||
return xsurface->data;
|
return &((struct sway_xwayland_view*)xsurface->data)->view;
|
||||||
}
|
}
|
||||||
|
|
||||||
void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
void handle_xwayland_surface(struct wl_listener *listener, void *data) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue