[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Serious bug in NSTextView (and a fix)
From: |
Ludovic Marcotte |
Subject: |
Re: Serious bug in NSTextView (and a fix) |
Date: |
Mon, 22 Oct 2001 13:35:04 -0400 (EDT) |
> Hi Ludovic,
Hi Nicola,
> sorry, am a bit ill today, so got sort of a fog in mind.
Sorry about that. Get some hot milk with honey :)
> I quite trust your testings :-) but didn't understand all of the
> explanation ... I would like to understand better why you get a crash at
> all ... - is the problem happening because the notification is retaining
> the NSTextView and causing it to be deallocated too late (say, after its
> window) ?
Exactly. And by reading the code, only -resignFirstResponder was
problematic.
> I suspect this because I notice that NSWindow -dealloc is not calling [_wv
> viewWillMoveToWindow: nil] before releasing _wv - while I think it should,
> because releasing _wv will not necessarily dealloc it, so we need to make
> sure we clean out the pointer in the views to the NSWindow before
> releasing _wv, otherwise _wv (and all subviews - which includes your
> NSTextView) will be left with an invalid pointer to the window and will
> likely crash at some point in the future. Can you try adding
>
> [_wv viewWillMoveToWindow: nil];
>
> in NSWindow.m -dealloc, before TEST_RELEASE (_wv), and let me know if we
> got any luck with this.
It does work and I must admit this fix is more clean than mine :)
> It's probably wrong, I'm a bit ill today, sorry, but let me know if you
> find out more about this problem. Anyway, in my fogs I seem to think that
> releasing the notification as in your patch is possibly only hiding the
> real bug, which is somewhere else.
I agree. Why do you think calling [_wv viewWillMoveToWindow: nil] is
wrong?
Ludo
--
Live as if you were to die tomorrow.
Learn as if you were to live forever.
- Gandhi