开发者

Memory corruption after using NSOpenPanel

开发者 https://www.devze.com 2023-04-05 10:19 出处:网络
I got a problem that leads to my program reporting malloc corruption when I use NSOpenPanel. My code is mainly C (not using Xcode) a开发者_如何转开发nd what I do is something like this:

I got a problem that leads to my program reporting malloc corruption when I use NSOpenPanel. My code is mainly C (not using Xcode) a开发者_如何转开发nd what I do is something like this:

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

Later I call something like this

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

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

}

After exiting the function (or a bit later) I will get

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

Ideas?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号