rsms / peertalk

iOS and Mac Cocoa library for communicating over USB
https://rsms.me/peertalk/
MIT License
3.43k stars 502 forks source link

Fix warnings when not using ARC #2

Closed andrewrothman closed 10 years ago

andrewrothman commented 12 years ago

Check if ARC is disabled and if so, call [super dealloc] when needed.

rsms commented 12 years ago

You need to do a lot more than this for peertalk to work in a non-ARC environment, like retain/release/autorelease of different objects. If you make a complete patch, I'll merge it.

andrewrothman commented 12 years ago

It seems to work in a non-ARC environment but whether is works well is the question. I'm not too sure. All this patch was meant to do was to get Xcode to stop complaining about the warnings. I don't think I'm willing to take up the full effort of porting to non-ARC or at least not at this time.

rsms commented 12 years ago

Just making the compiler stop complaining is like putting a screaming baby in the basement — you momentarily alter on the effects w/o actually solving on the problem. Peertalk will leak like a broken umbrella and crash like a dead bird with this patch. If you don't like ARC for some reason, then you have no choice but to manage all references.

andrewrothman commented 12 years ago

That's true. I wan't sure whether or not any additional work had to be done. I'm not an expert in memory management. What else would need to be released?

rsms commented 12 years ago

@andyrothtech Read this http://www.fallingcanbedeadly.com/posts/objective-c-reference-counting-from-the-bottom-up and this http://developer.apple.com/documentation/General/Conceptual/DevPedia-CocoaCore/MemoryManagement.html

rsms commented 12 years ago

Also, ARC is according to Apple the future (and I agree), so unless you plan on supporting iOS 3x and older, or old versions of OS X, you should build this library with ARC (you can still write your own code w/o ARC — it's a per-source-file configuration).

rsms commented 10 years ago

Let me know if 1e30f1f8c96203c2a3aa736bd793aa27e5f0b6e1 solved your issues.