Commit 04c703a2 authored by Dorota Czaplejewicz's avatar Dorota Czaplejewicz
Browse files

phosh: Fix crash when an xdg_surface is missing either a title or an app_id

parent e266c319
Pipeline #1549 canceled with stages
......@@ -54,6 +54,7 @@ egl = dependency('egl')
glesv2 = dependency('glesv2')
drm = dependency('libdrm')
gbm = dependency('gbm', version: '>=17.1.0')
glib = dependency('glib-2.0', version: '>=2.16')
libinput = dependency('libinput', version: '>=1.7.0')
xkbcommon = dependency('xkbcommon')
udev = dependency('libudev')
......
......@@ -19,5 +19,5 @@ if get_option('enable-xwayland')
sources += ['xwayland.c']
endif
executable(
'rootston', sources, dependencies: [wlroots, wlr_protos, pixman]
'rootston', sources, dependencies: [wlroots, wlr_protos, pixman, glib]
)
#define _POSIX_C_SOURCE 200112L
#include <assert.h>
#include <glib.h>
#include <stdlib.h>
#include <unistd.h>
#include <wayland-server.h>
......@@ -73,16 +74,16 @@ static void xdg_switcher_handle_raise_xdg_surfaces(struct wl_client *client,
if (view->xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL
|| !view->xdg_surface->mapped)
continue;
if (!strcmp(app_id, view->xdg_surface->toplevel->app_id) &&
!strcmp(title, view->xdg_surface->toplevel->title))
if (!g_strcmp0(app_id, view->xdg_surface->toplevel->app_id) &&
!g_strcmp0(title, view->xdg_surface->toplevel->title))
found_view = view;
break;
case ROOTS_XDG_SHELL_V6_VIEW:
if (view->xdg_surface_v6->role != WLR_XDG_SURFACE_V6_ROLE_TOPLEVEL
|| !view->xdg_surface_v6->mapped)
continue;
if (!strcmp(app_id, view->xdg_surface_v6->toplevel->app_id) &&
!strcmp(title, view->xdg_surface_v6->toplevel->title))
if (!g_strcmp0(app_id, view->xdg_surface_v6->toplevel->app_id) &&
!g_strcmp0(title, view->xdg_surface_v6->toplevel->title))
found_view = view;
break;
default:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment