[gtk-osx-devel] [PATCH] gtk-mac-integration reference counting



Hi John, 

I ran the latest clang static analyzer [1] over gtk-mac-integration - here's a patch for a couple of ref-counting issues it found. Nothing that looks crucial but nice to have all the same. I've compiled it but have not tested it and as I rarely use objective-c it's worth casting your eye over it. 

My understanding is that class methods return an autoreleased object, so, e.g. [NSString stringWithUTF8String:] doesn't require an explicit release [2]. 

I've also renamed gtk_mac_image_from_pixbuf() -> gtk_create_cgimage_from_pixbuf() to indicate the returned CGImage is owned by the caller. This function isn't exposed in the bindings. 

Lastly, their scan-build tool is very useful but doesn't quite run out-of-the-box with gtk-mac-integration as I couldn't find a way to force it to parse objective-c, except for renaming the source files .objectivec, which automake then choked on. So I just ran: 

$ for x in *.c; do ./checker-260/bin/clang --analyze -x objective-c [whole bunch of includes] $x; done 

... manually, and did without the pretty HTML reporting. 

best, 
Richard. 

[1] http://clang-analyzer.llvm.org/
[2] http://stackoverflow.com/questions/6578/understanding-reference-counting-with-cocoa-and-objective-c

Attachment: mac_integration_clang_analyze.patch
Description: Binary data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]