fix: wrap BackingScaleFactor in autoreleasepool to stop NSDictionary accumulation on macOS (#15623)

Signed-off-by: Viktor Kuksgauzen <vkpiar@gmail.com>
This commit is contained in:
Kuksgauzen
2026-07-21 01:42:43 +04:00
committed by GitHub
parent 7696b0ee51
commit 5b4d6baf47

View File

@@ -118,6 +118,7 @@ extern "C" bool MacCheckAdminAuthorization() {
// https://gist.github.com/briankc/025415e25900750f402235dbf1b74e42 // https://gist.github.com/briankc/025415e25900750f402235dbf1b74e42
extern "C" float BackingScaleFactor(uint32_t display) { extern "C" float BackingScaleFactor(uint32_t display) {
@autoreleasepool {
NSArray<NSScreen *> *screens = [NSScreen screens]; NSArray<NSScreen *> *screens = [NSScreen screens];
for (NSScreen *screen in screens) { for (NSScreen *screen in screens) {
NSDictionary *deviceDescription = [screen deviceDescription]; NSDictionary *deviceDescription = [screen deviceDescription];
@@ -129,6 +130,7 @@ extern "C" float BackingScaleFactor(uint32_t display) {
} }
return 1; return 1;
} }
}
// https://github.com/jhford/screenresolution/blob/master/cg_utils.c // https://github.com/jhford/screenresolution/blob/master/cg_utils.c
// https://github.com/jdoupe/screenres/blob/master/setgetscreen.m // https://github.com/jdoupe/screenres/blob/master/setgetscreen.m