Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 24aac5e

Browse files
committed
[[ Bug 21921 ]] Ensure MCGRegion destructor is called
This patch changes the use of MCMemoryNew/MCMemoryDelete to MCMemoryCreate/MCMemoryDestroy. This is necessary because the internal __MCGRegion struct has an implicit constructor due to it wrapping an SkRegion which needs a destructor when the region becomes complex (i.e. not being a single rectangle).
1 parent 009e465 commit 24aac5e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/notes/bugfix-21921.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix memory leak when redrawing non-rectangular update regions

libgraphics/src/region.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ bool MCGRegionCreate(MCGRegionRef &r_region)
3131
t_region = nil;
3232

3333
if (t_success)
34-
t_success = MCMemoryNew(t_region);
34+
t_success = MCMemoryCreate(t_region);
3535

3636
if (t_success)
3737
r_region = t_region;
@@ -46,7 +46,7 @@ void MCGRegionDestroy(MCGRegionRef p_region)
4646
if (p_region == nil)
4747
return;
4848

49-
MCMemoryDelete(p_region);
49+
MCMemoryDestroy(p_region);
5050
}
5151

5252
bool MCGRegionCopy(MCGRegionRef p_region, MCGRegionRef &r_copy)

0 commit comments

Comments
 (0)