Xcode分析器抱怨CFContextRef存储在“ assign” @property中

问题描述 投票:0回答:1

我有一个Cocoa类,需要长时间保持位图上下文以进行像素操作。

@property (assign, nonatomic) CGContextRef cacheContext; // block of pixels

在我的班级初始化中:

// this creates a 32bit ARGB context, fills it with the contents of a UIImage and returns a CGContextRef
[self setCacheContext:[self allocContextWithImage:[self someImage]]];

和在dealloc中:

CGContextRelease([self cacheContext]);

Xcode分析器公司关于init泄漏了CGContextRef类型的对象,并且在dealloc中抱怨“对调用者所不拥有的对象的错误减量。”]

我相信这一切都很好,并且运行良好。

我如何告诉Xcode一切正常,不要抱怨呢?

我有一个Cocoa类,需要长时间保持位图上下文以进行像素处理。 @property(assign,nonatomic)CGContextRef cacheContext; //我班级的像素块...

xcode cocoa core-foundation analyzer
1个回答
1
投票

好吧,考虑到这里的讨论,我认为这将解决分析器的问题,让您保留自己的正式财产,并且不违反任何内存管理规则。

© www.soinside.com 2019 - 2024. All rights reserved.