[Bf-blender-cvs] [87c949a3bdd] master: macOS/Ghost: Fix memory leak.

Corbin Dunn noreply at git.blender.org
Wed Mar 3 16:59:19 CET 2021


Commit: 87c949a3bddce445e56337efc6764e29dcfab36c
Author: Corbin Dunn
Date:   Wed Mar 3 21:25:20 2021 +0530
Branches: master
https://developer.blender.org/rB87c949a3bddce445e56337efc6764e29dcfab36c

macOS/Ghost: Fix memory leak.

`new` allocates a new object that needs to be autoreleased.

Reviewed By: #platform_macos, sebbas, ankitm
Maniphest Tasks: T86222
Differential Revision: https://developer.blender.org/D10597

===================================================================

M	intern/ghost/intern/GHOST_WindowViewCocoa.h

===================================================================

diff --git a/intern/ghost/intern/GHOST_WindowViewCocoa.h b/intern/ghost/intern/GHOST_WindowViewCocoa.h
index 14c70382916..f47e02704b2 100644
--- a/intern/ghost/intern/GHOST_WindowViewCocoa.h
+++ b/intern/ghost/intern/GHOST_WindowViewCocoa.h
@@ -253,7 +253,7 @@
 
 - (NSAttributedString *)attributedSubstringFromRange:(NSRange)range
 {
-  return [NSAttributedString new];  // XXX does this leak?
+  return [[[NSAttributedString alloc] init] autorelease];
 }
 
 - (NSRange)markedRange
@@ -284,7 +284,7 @@
 
 - (NSArray *)validAttributesForMarkedText
 {
-  return [NSArray array];  // XXX does this leak?
+  return [NSArray array];
 }
 
 @end



More information about the Bf-blender-cvs mailing list