Skip to content

Commit

Permalink
ws: Do not leak damage list on surface destruction
Browse files Browse the repository at this point in the history
Clear the list of damage rectangles when a surface is destroyed, to
avoid leaking them and slowly filling the damage map with unneeded,
stale entries.
  • Loading branch information
aperezdc committed Mar 16, 2024
1 parent 62281cb commit 11b4e6d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ws.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ GSourceFuncs ServerSource::s_sourceFuncs = {

static const struct wl_surface_interface s_surfaceInterface = {
// destroy
[](struct wl_client*, struct wl_resource*) { },
[](struct wl_client*, struct wl_resource *surfaceResource) {
auto& surface = *static_cast<Surface*>(wl_resource_get_user_data(surfaceResource));
Instance::singleton().clearPendingBufferDamage(surface.bufferResource);
},
// attach
[](struct wl_client*, struct wl_resource* surfaceResource, struct wl_resource* bufferResource, int32_t, int32_t)
{
Expand Down

0 comments on commit 11b4e6d

Please sign in to comment.