surface: Add null check on role_data 39/295239/2
authorSeunghun Lee <shiin.lee@samsung.com>
Fri, 2 Jun 2023 04:33:46 +0000 (13:33 +0900)
committerSeunghun Lee <shiin.lee@samsung.com>
Tue, 4 Jul 2023 07:02:10 +0000 (07:02 +0000)
The role_data can be null if the role is no longer valid.

Change-Id: If7da1906ea9c8aa1bffc440417ea7881c22e57ab

src/shell_surface.c
src/xdg_shell/xdg_surface.c
src/xdg_shell_v6/xdg_surface_v6.c

index 9d7fab1..e6dc75b 100644 (file)
@@ -224,6 +224,9 @@ handle_shell_surface_commit(struct ds_surface *surface)
     struct ds_shell_surface *shell_surface;
 
     shell_surface = ds_surface_get_role_data(surface);
+    if (!shell_surface)
+        return;
+
     shell_surface->current = shell_surface->pending;
 
     switch (shell_surface->role) {
index 4a797a0..8e2f0a8 100644 (file)
@@ -201,6 +201,9 @@ handle_xdg_surface_commit(struct ds_surface *ds_surface)
     struct ds_xdg_surface *surface;
 
     surface = ds_surface_get_role_data(ds_surface);
+    if (!surface)
+        return;
+
     surface->current = surface->pending;
 
     switch (surface->role) {
index 8483c59..8e383a0 100644 (file)
@@ -198,6 +198,9 @@ handle_xdg_surface_v6_commit(struct ds_surface *ds_surface)
     struct ds_xdg_surface_v6 *surface;
 
     surface = ds_surface_get_role_data(ds_surface);
+    if (!surface)
+        return;
+
     surface->current = surface->pending;
 
     switch (surface->role) {