wayland: Move frame callback destructor to SurfaceState destructor

This commit is contained in:
Vlad Zahorodnii 2023-09-10 12:31:10 +03:00
parent 4c397a9526
commit 41e5409b23
2 changed files with 11 additions and 19 deletions

View file

@ -57,24 +57,6 @@ SurfaceInterfacePrivate::SurfaceInterfacePrivate(SurfaceInterface *q)
{
}
SurfaceInterfacePrivate::~SurfaceInterfacePrivate()
{
wl_resource *resource;
wl_resource *tmp;
wl_resource_for_each_safe (resource, tmp, &current->frameCallbacks) {
wl_resource_destroy(resource);
}
wl_resource_for_each_safe (resource, tmp, &pending->frameCallbacks) {
wl_resource_destroy(resource);
}
for (const auto &stash : std::as_const(stashed)) {
wl_resource_for_each_safe (resource, tmp, &stash->frameCallbacks) {
wl_resource_destroy(resource);
}
}
}
void SurfaceInterfacePrivate::addChild(SubSurfaceInterface *child)
{
// protocol is not precise on how to handle the addition of new sub surfaces
@ -545,6 +527,16 @@ SurfaceState::SurfaceState()
wl_list_init(&frameCallbacks);
}
SurfaceState::~SurfaceState()
{
wl_resource *resource;
wl_resource *tmp;
wl_resource_for_each_safe (resource, tmp, &frameCallbacks) {
wl_resource_destroy(resource);
}
}
void SurfaceState::mergeInto(SurfaceState *target)
{
target->serial = serial;

View file

@ -30,6 +30,7 @@ class FractionalScaleV1Interface;
struct SurfaceState
{
SurfaceState();
~SurfaceState();
void mergeInto(SurfaceState *target);
@ -95,7 +96,6 @@ public:
}
explicit SurfaceInterfacePrivate(SurfaceInterface *q);
~SurfaceInterfacePrivate() override;
void addChild(SubSurfaceInterface *subsurface);
void removeChild(SubSurfaceInterface *subsurface);