subsurface: Add missing cache initialization 64/295764/1
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 13 Apr 2023 01:08:22 +0000 (10:08 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Thu, 13 Jul 2023 09:24:21 +0000 (18:24 +0900)
This is to fix a crash attempting to use uninitilized cache state.

Change-Id: Ic7d4e241dee046e98b030c6ade815c28b55408bc

src/compositor/subsurface.c

index 28edb0a..142f65b 100644 (file)
@@ -93,6 +93,7 @@ create_subsurface(struct wl_resource *factory_resource,
     wl_signal_init(&subsurface->events.cached);
     wl_signal_init(&subsurface->events.request_move);
 
+    surface_state_init(&subsurface->cached);
     subsurface_link_surface(subsurface, surface);
     subsurface_link_parent(subsurface, parent);
 
@@ -117,6 +118,7 @@ subsurface_commit(struct ds_subsurface *subsurface)
     struct ds_subsurface *child;
 
     if (subsurface_is_synchronized(subsurface)) {
+        surface_state_init(&subsurface->cached);
         surface_state_move(&subsurface->cached, &surface->pending);
         subsurface->has_cache = true;