gnustep-dev
[Top][All Lists]
Advanced

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

Memory Management


From: Stefan Bidigaray
Subject: Memory Management
Date: Mon, 13 Jul 2009 22:01:27 -0500

I'm debugging the NSSound stuff and have run into a bit of a problem with memory management and the whole RETAIN/RELEASE stuff... I'm sure my probably has do to with being a novice.

Anyway, in the -dealloc method of NSSound I call RELEASE(_data) and right after it [nameDict removeObjectForKey: _name].  The dictionary nameDict contains as a key the sound name and as a value the NSSound object associated with it.  Well, whenever this method is called it will go ahead and call NSSound's -dealloc again which in turn sends another call out to RELEASE(_data).  As you can imagine it blows up at this point.

So my question is:  Would adding a RETAIN(self) just before the call to [nameDict removeObjectForKey: _name] solve this issue?  Anything else?  This seems to do the trick, but I'm wondering if it's correct.

Thanks
Stefan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]