hwc: Modify ds_tizen_hwc destruction logic 49/317949/1 accepted/tizen_9.0_unified accepted/tizen_unified_toolchain tizen_9.0 accepted/tizen/9.0/unified/20241030.231741 accepted/tizen/unified/20240924.153216 accepted/tizen/unified/toolchain/20241004.102019 accepted/tizen/unified/x/20240925.015939 accepted/tizen/unified/x/asan/20241014.000419 tizen_9.0_m2_release
authorTaeHyeon Jeong <thyeon.jeong@samsung.com>
Wed, 4 Sep 2024 09:24:19 +0000 (18:24 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 23 Sep 2024 04:09:29 +0000 (13:09 +0900)
AS-IS
- when hwc is destroyed, client is not destroyed together

TO-BE
- client is also destroyed with hwc

Change-Id: I3706afeacc3388350391531188786cae3127eb3f

src/hwc/hwc.c

index 837798a955856404c68b378aacd863c897599416..d618dafddf8de3d1e4960e1406f588d38713e5f2 100644 (file)
@@ -208,14 +208,21 @@ static void
 hwc_handle_display_destroy(struct wl_listener *listener, void *data)
 {
     struct ds_tizen_hwc *hwc;
+    struct ds_tizen_hwc_client *client, *tmp;
 
     hwc = wl_container_of(listener, hwc, destroy);
 
     ds_inf("Global destroy: hwc(%p)", hwc);
 
-    wl_signal_emit(&hwc->events.destroy, hwc);
     wl_list_remove(&hwc->destroy.link);
+
+    wl_list_for_each_safe(client, tmp, &hwc->clients, link)
+        wl_resource_destroy(client->resource);
+
     wl_global_destroy(hwc->global);
+
+    wl_signal_emit(&hwc->events.destroy, hwc);
+
     free(hwc);
 }