surface: Release buffer after commit event 26/296526/1 accepted/tizen/unified/20230808.170212
authorSeunghun Lee <shiin.lee@samsung.com>
Fri, 28 Jul 2023 05:08:41 +0000 (14:08 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 31 Jul 2023 08:04:29 +0000 (17:04 +0900)
A buffer has to be unlocked after commit event so that the buffer can be
released immediately when unlocked by a compositor.

Change-Id: If7383a2432baf90df39f1457e3a3edf3bfcbac74

src/compositor/surface.c

index a9fd6e9..e02e6cc 100644 (file)
@@ -400,6 +400,14 @@ surface_commit_state(struct ds_surface *surface, struct ds_surface_state *next)
         surface->role->commit(surface);
 
     wl_signal_emit_mutable(&surface->events.commit, surface);
+
+    // Release the buffer after emitting the commit event, so that listeners
+    // can take full control over the buffer. Don't leave the buffer locked so
+    // that the buffer can be released immediately when unlocked by listeners.
+    if (surface->buffer) {
+        ds_buffer_unlock(surface->buffer);
+        surface->buffer = NULL;
+    }
 }
 
 void