使用NSOpenPanel后内存损坏

时间:2011-09-14 19:36:14

标签: macos cocoa memory-management

当我使用NSOpenPanel时,我遇到了导致我的程序报告malloc损坏的问题。我的代码主要是C(不使用Xcode),我做的是这样的:

main(..)
{
   [NSApplication sharedApplication];
   ... create window etc, no problem
   [NSApp run];
}

后来我打电话给这样的事情

openFileDialog(..)
{
 // tried to create NSAutoreleasePool and things here bit still breaks

 NSOpenPanel* open = [NSOpenPanel openPanel];
 int res = [open runModal]
 ...

}

退出该功能后(或稍后)我会得到

test (1948,0x7fff7d852960) malloc: * error for object 0x7ff19b879608: 
incorrect checksum for freed object - object was probably modified after being freed.
* set a breakpoint in malloc_error_break to debug

想法?

0 个答案:

没有答案