[Interest] OS X/Qt 5: Extening app with Obj C++/Cocoa: Memory Management?

Till Oliver Knoll till.oliver.knoll at gmail.com
Tue Dec 10 10:10:31 CET 2013


My question is inspired by the other thread "QMacNativeWidget & memory management": assume on Mac OS X I want to extend a Qt 5 app with ObjC++ and Cocoa. Would I manage memory myself using increase/decrease of object references, or could I rely on Automatic Reference Counting (ARC - compiler switch, I assume)?

Would it matter how Qt is compiled (with/without ARC - specifically the pre-build Qt packages)?

Assuming Qt was /not/ compiled using ARC, but my own ObjC code was: when I would call some OS specific Qt API which would, say, instantiate and return some "parent NSView", would I have to specify that call as "the returned objects needs to be deallocated using manual reference counting" (using a "__bridge" cast of some kind?") and then call "release" explicitly on that returned object myself?

My ObjC knowledge: "I started reading that book on iOS development" + some online tutorials, so sorry for the noob questions here. But I'd just be interested in general how well (if at all) custom ObjC code using ARC would work together with Qt, and what the general caveats, dos and don'ts would be.

Any experience to share? :)

Thank you,

More information about the Interest mailing list