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
Loading
Please register or sign in to comment