[Impeller] Fix leak of rectangle packer in typographer tests (flutter/engine#51113)

This commit is contained in:
Jason Simmons
2024-02-29 19:03:04 -08:00
committed by GitHub
parent 0e3cb6d640
commit f37e96e73b
2 changed files with 4 additions and 3 deletions

View File

@@ -166,8 +166,9 @@ void SkylineRectanglePacker::addSkylineLevel(int skylineIndex,
}
}
RectanglePacker* RectanglePacker::Factory(int width, int height) {
return new SkylineRectanglePacker(width, height);
std::unique_ptr<RectanglePacker> RectanglePacker::Factory(int width,
int height) {
return std::make_unique<SkylineRectanglePacker>(width, height);
}
} // namespace impeller

View File

@@ -27,7 +27,7 @@ class RectanglePacker {
//----------------------------------------------------------------------------
/// @brief Return an empty packer with area specified by width and height.
///
static RectanglePacker* Factory(int width, int height);
static std::unique_ptr<RectanglePacker> Factory(int width, int height);
virtual ~RectanglePacker() {}