Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 79d6d0c1 authored by Lloyd Pique's avatar Lloyd Pique
Browse files

graphics: Base resource classes need virtual dtor

ComposerResources allows a derived class to define specializations of
the ComposerDisplayResource and ComposerLayerResource classes, which are
returned by overrides of the createDisplayResources() and
createLayerResources() member functions. The pointers are wrapped using
a std::unique_ptr, which destroys the owned instance via the base class
destructor.

As the destructor was not virtual, this meant that only the base class
destructor functionality would be used. Any additional cleanup done by
the derived class destructor would not be run!

This impacts the composer-hal 2.2 utility code for example, which adds a
readback buffer cache as a display resource. Any readback buffers that
are imported there will not be released, effectively leaking graphic
buffer memory.

It also affected an ARC++ specialization where a similar per-layer buffer
resource cache was added, and where the leak was observable since layers
are created and destroyed much more often than displays.

Bug: 117877825
Test: No leaks for ARC++ devices
Change-Id: I6e604b415d3ed787c2e51729a77278594e41e7a9
parent 7304f95d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment