> Am 10.01.2023 um 01:42 schrieb Riccardo Mottola <riccardo.mott...@libero.it>:
> 
> Hi,
> 
> 
> Riccardo Mottola wrote:
>> y to understand if this is more a GUI or a ProjectCenter issue 
> 
> I checked this a little more, also with Fred. The SplitView looses its 
> delegate.. it must be one of the subviews. I suppose the Editor subview, 
> because it happens only if a proper editor is loader.
> Editor loading is a bit complex since the Framework loads some editor Bundles.
> The Editor itself can function both as in-window and in-project...
> 
> Anyone has a good clue?

<rant>
Yes. It's 2023 (happy new year, btw). Use an up to date compiler and declare 
the delegate as a zeroing weak reference.
</rant>

Apart from that, the problem is that you've closed the editor window and the 
editor object has been released and deallocated, but the editor window still 
exists and is still receiving events after the window has been closed. While 
-[NSWindow sendEvent:] ignores most events for closed windows is does still 
accept NSAppKitDefined events (for instance, your window manager could post a 
window moved event; I've seen that happening under Gnome for windows after they 
were closed). If for some reason the cursor rectangles of that window have been 
invalidated, sendEvent: will reset all cursor rectangles. Now if the window 
happens to contain a split view, that split view will ask its delegate for the 
size of the divider. Unfortunately, though, in this case the delegate has been 
deallocated (without the relevant pointer being reset) and hence the program 
crashes.

I'm not really familiar with the cursor rectangle code, but it seems to me that 
there is no point resetting the cursor rectangles after a window has been 
closed. With a little bit of luck, just changing the condition
  !_f.cursor_rects_valid
in line 4071 of NSWindow.m (fairly at the beginning of the -[NSWindow 
sendEvent:] method) into
  !_f.cursor_rects_valid && !_f.has_closed
should be enough to fix this issue. And hopefully it doesn't break anything for 
windows that aren't released upon closing. But it's worth reviewing that the 
cursor rectangles will be reset when such a window is opened again.

Wolfgang


Reply via email to