Fix segfaults in wlr_surface_is_*
This commit is contained in:
parent
bfcd3f3707
commit
3bce5dfc9f
|
@ -13,7 +13,8 @@
|
||||||
static const char *wlr_wl_shell_surface_role = "wl-shell-surface";
|
static const char *wlr_wl_shell_surface_role = "wl-shell-surface";
|
||||||
|
|
||||||
bool wlr_surface_is_wl_shell_surface(struct wlr_surface *surface) {
|
bool wlr_surface_is_wl_shell_surface(struct wlr_surface *surface) {
|
||||||
return strcmp(surface->role, wlr_wl_shell_surface_role) == 0;
|
return surface->role != NULL &&
|
||||||
|
strcmp(surface->role, wlr_wl_shell_surface_role) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_wl_surface *wlr_wl_shell_surface_from_wlr_surface(
|
struct wlr_wl_surface *wlr_wl_shell_surface_from_wlr_surface(
|
||||||
|
|
|
@ -17,8 +17,9 @@ static const char *wlr_desktop_xdg_toplevel_role = "xdg_toplevel";
|
||||||
static const char *wlr_desktop_xdg_popup_role = "xdg_popup";
|
static const char *wlr_desktop_xdg_popup_role = "xdg_popup";
|
||||||
|
|
||||||
bool wlr_surface_is_xdg_surface(struct wlr_surface *surface) {
|
bool wlr_surface_is_xdg_surface(struct wlr_surface *surface) {
|
||||||
return strcmp(surface->role, wlr_desktop_xdg_toplevel_role) == 0 ||
|
return surface->role != NULL &&
|
||||||
strcmp(surface->role, wlr_desktop_xdg_popup_role) == 0;
|
(strcmp(surface->role, wlr_desktop_xdg_toplevel_role) == 0 ||
|
||||||
|
strcmp(surface->role, wlr_desktop_xdg_popup_role) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xdg_surface *wlr_xdg_surface_from_wlr_surface(
|
struct wlr_xdg_surface *wlr_xdg_surface_from_wlr_surface(
|
||||||
|
|
|
@ -17,8 +17,9 @@ static const char *wlr_desktop_xdg_toplevel_role = "xdg_toplevel_v6";
|
||||||
static const char *wlr_desktop_xdg_popup_role = "xdg_popup_v6";
|
static const char *wlr_desktop_xdg_popup_role = "xdg_popup_v6";
|
||||||
|
|
||||||
bool wlr_surface_is_xdg_surface_v6(struct wlr_surface *surface) {
|
bool wlr_surface_is_xdg_surface_v6(struct wlr_surface *surface) {
|
||||||
return strcmp(surface->role, wlr_desktop_xdg_toplevel_role) == 0 ||
|
return surface->role != NULL &&
|
||||||
strcmp(surface->role, wlr_desktop_xdg_popup_role) == 0;
|
(strcmp(surface->role, wlr_desktop_xdg_toplevel_role) == 0 ||
|
||||||
|
strcmp(surface->role, wlr_desktop_xdg_popup_role) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_from_wlr_surface(
|
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_from_wlr_surface(
|
||||||
|
|
|
@ -80,7 +80,8 @@ const char *atom_map[ATOM_LAST] = {
|
||||||
const char *wlr_xwayland_surface_role = "wlr_xwayland_surface";
|
const char *wlr_xwayland_surface_role = "wlr_xwayland_surface";
|
||||||
|
|
||||||
bool wlr_surface_is_xwayland_surface(struct wlr_surface *surface) {
|
bool wlr_surface_is_xwayland_surface(struct wlr_surface *surface) {
|
||||||
return strcmp(surface->role, wlr_xwayland_surface_role) == 0;
|
return surface->role != NULL &&
|
||||||
|
strcmp(surface->role, wlr_xwayland_surface_role) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface(
|
struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface(
|
||||||
|
|
Loading…
Reference in New Issue