surface: Fix emitting commit event twice 09/280209/2
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 25 Aug 2022 07:23:32 +0000 (16:23 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Fri, 26 Aug 2022 00:39:13 +0000 (00:39 +0000)
This patch removes one of the commit events being emitted and therefore
the commit event is emitted in surface_commit_state() once.
And this moves surface->role->commit() accordingly.

Change-Id: I427d3170b53acc08527892c2c2dc2f559870231e

src/surface/surface.c

index 2acb38b..e421da0 100644 (file)
@@ -376,11 +376,6 @@ surface_handle_commit(struct wl_client *client, struct wl_resource *resource)
     surface_commit_state(surface, &surface->pending);
 
     // TODO handle subsurfaces of a given surface
-
-    if (surface->role && surface->role->commit)
-        surface->role->commit(surface);
-
-    wl_signal_emit(&surface->events.commit, surface);
 }
 
 static void
@@ -720,6 +715,9 @@ surface_commit_state(struct ds_surface *surface, struct ds_surface_state *next)
     if (surface->current.committed & DS_SURFACE_STATE_BUFFER)
         surface_update_buffer(surface);
 
+    if (surface->role && surface->role->commit)
+        surface->role->commit(surface);
+
     wl_signal_emit(&surface->events.commit, surface);
 }