Re: Right place to unobserve notifications in a document

2008-08-20 Thread Joan Lluch (casa)
Am Mo,18.08.2008 um 20:14 schrieb Andy Lee: Since the observed object (maybe notification center) will still hold a reference to the observing object, there is a problem. The *observer* will not be freed, if the observed is still living. Obviously you have a problem using GC, for

Re: Right place to unobserve notifications in a document

2008-08-20 Thread Negm-Awad Amin
Am Mi,20.08.2008 um 15:37 schrieb Joan Lluch (casa): Am Mo,18.08.2008 um 20:14 schrieb Andy Lee: Since the observed object (maybe notification center) will still hold a reference to the observing object, there is a problem. The *observer* will not be freed, if the observed is still

Re: Right place to unobserve notifications in a document

2008-08-20 Thread Joan Lluch (casa)
Joan Lluch El 20/08/2008, a las 16:05, Negm-Awad Amin escribió: Am Mi,20.08.2008 um 15:37 schrieb Joan Lluch (casa): I've been reading this thread and I don't understand it in the case of GC. Why don't you still have to remove the observer from the notification center when you are

Re: Right place to unobserve notifications in a document

2008-08-20 Thread Negm-Awad Amin
Am Mi,20.08.2008 um 16:58 schrieb Joan Lluch (casa): Joan Lluch El 20/08/2008, a las 16:05, Negm-Awad Amin escribió: Am Mi,20.08.2008 um 15:37 schrieb Joan Lluch (casa): I've been reading this thread and I don't understand it in the case of GC. Why don't you still have to remove the

Re: Right place to unobserve notifications in a document

2008-08-20 Thread Michael Ash
On Wed, Aug 20, 2008 at 9:37 AM, Joan Lluch (casa) [EMAIL PROTECTED] wrote: Am Mo,18.08.2008 um 20:14 schrieb Andy Lee: Since the observed object (maybe notification center) will still hold a reference to the observing object, there is a problem. The *observer* will not be freed, if the

Re: Right place to unobserve notifications in a document

2008-08-19 Thread Negm-Awad Amin
Am Mo,18.08.2008 um 20:14 schrieb Andy Lee: On Aug 18, 2008, at 12:49 PM, Negm-Awad Amin wrote: Am Mo,18.08.2008 um 18:18 schrieb Andy Lee: -- but in this case I think -dealloc is not only okay, but sometimes the only correct place to unregister a notification. Suppose an invariant of

Right place to unobserve notifications in a document

2008-08-18 Thread Negm-Awad Amin
Hi, for some teaching reasons I have a document class, which observes a notification. Of course I have to unobserve this notification, when the document is closed. Doing this in -dealloc is no good design (fuunctional overhead in -dealloc, garbage collection …). But I read in the

Re: Right place to unobserve notifications in a document

2008-08-18 Thread Negm-Awad Amin
Am Mo,18.08.2008 um 17:37 schrieb Michael Ash: On Mon, Aug 18, 2008 at 5:59 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote: Hi, for some teaching reasons I have a document class, which observes a notification. Of course I have to unobserve this notification, when the document is closed. Doing

Re: Right place to unobserve notifications in a document

2008-08-18 Thread Andy Lee
On Aug 18, 2008, at 11:51 AM, Negm-Awad Amin wrote: But anyway I do not think, that doing something else then memory management in -dealloc is good design. Normally I unregister observation in delegate methods like -applicationWillTerminate:. I understand your concern -- you meant

Re: Right place to unobserve notifications in a document

2008-08-18 Thread Negm-Awad Amin
Am Mo,18.08.2008 um 18:18 schrieb Andy Lee: On Aug 18, 2008, at 11:51 AM, Negm-Awad Amin wrote: But anyway I do not think, that doing something else then memory management in -dealloc is good design. Normally I unregister observation in delegate methods like -applicationWillTerminate:. I

Re: Right place to unobserve notifications in a document

2008-08-18 Thread Michael Ash
On Mon, Aug 18, 2008 at 11:51 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote: But anyway I do not think, that doing something else then memory management in -dealloc is good design. Normally I unregister observation in delegate methods like -applicationWillTerminate:. I think you may be a little

Re: Right place to unobserve notifications in a document

2008-08-18 Thread Negm-Awad Amin
Am Mo,18.08.2008 um 18:57 schrieb Michael Ash: On Mon, Aug 18, 2008 at 11:51 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote: But anyway I do not think, that doing something else then memory management in -dealloc is good design. Normally I unregister observation in delegate methods like

Re: Right place to unobserve notifications in a document

2008-08-18 Thread Andy Lee
On Aug 18, 2008, at 12:49 PM, Negm-Awad Amin wrote: Am Mo,18.08.2008 um 18:18 schrieb Andy Lee: -- but in this case I think -dealloc is not only okay, but sometimes the only correct place to unregister a notification. Suppose an invariant of your design is that an object should receive