gnustep-dev
[Top][All Lists]
Advanced

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

Re: crash in GUI / ProjectCenter


From: Riccardo Mottola
Subject: Re: crash in GUI / ProjectCenter
Date: Tue, 10 Jan 2023 18:37:37 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 SeaMonkey/2.53.14

Hi Wolfgang,

Happy new Yar, nice to read back from you.


Wolfgang Lux wrote:
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.

So you think it is the split view delegate. We came to a similar conclusion.

I had a quick different attempt: in PCProjectWindow (which is actually more the controller, I think... perhaps ot should be renamed). In deallock, I try to set

  [h_split setDelegate:nil];
  [v_split setDelegate:nil];

before propagating [projectWindow close].

That make sthe stactrace change from:

#0  0x00007ffff6e267ae in objc_msg_lookup () from /Local/Library/Libraries/libobjc.so.4 #1  0x00007ffff7b5ba6f in -[NSSplitView _dividerRectForIndex:] (self=0x555555c98a98, _cmd=<optimized out>, index=0)
    at NSSplitView.m:107
#2  0x00007ffff7b5e2e7 in -[NSSplitView resetCursorRects] (self=0x555555c98a98, _cmd=<optimized out>)
    at NSSplitView.m:1399
#3  0x00007ffff7bcd31f in resetCursorRectsForView (theView=0x555555c98a98) at NSWindow.m:3002 #4  0x00007ffff7bcd3bc in resetCursorRectsForView (theView=<optimized out>) at NSWindow.m:3017 #5  0x00007ffff7bcd3bc in resetCursorRectsForView (theView=<optimized out>) at NSWindow.m:3017 #6  0x00007ffff7bcfba1 in -[NSWindow resetCursorRects] (self=0x555556257fe8, _cmd=<optimized out>) at NSWindow.m:3189 #7  0x00007ffff7bd0ede in -[NSWindow sendEvent:] (self=0x555556257fe8, _cmd=<optimized out>, theEvent=0x555555e03c08)
    at NSWindow.m:4073
#8  0x00007ffff7a37e6e in -[NSApplication run] (self=0x55555591c158, _cmd=<optimized out>) at NSApplication.m:1585 #9  0x00007ffff7a17dd9 in NSApplicationMain (argc=<optimized out>, argv=<optimized out>) at Functions.m:119
#10 0x00007ffff6c5018a in ?? () from /lib64/libc.so.6
#11 0x00007ffff6c50245 in __libc_start_main () from /lib64/libc.so.6
#12 0x0000555555561171 in _start ()

to


#0  0x00007ffff6e26732 in objc_msg_lookup () from /Local/Library/Libraries/libobjc.so.4 #1  0x00007ffff7bcd317 in resetCursorRectsForView (theView=0x555556007cb8) at NSWindow.m:3002 #2  0x00007ffff7bcd3bc in resetCursorRectsForView (theView=<optimized out>) at NSWindow.m:3017 #3  0x00007ffff7bcd3bc in resetCursorRectsForView (theView=<optimized out>) at NSWindow.m:3017 #4  0x00007ffff7bcd3bc in resetCursorRectsForView (theView=<optimized out>) at NSWindow.m:3017 #5  0x00007ffff7bcd3bc in resetCursorRectsForView (theView=<optimized out>) at NSWindow.m:3017 #6  0x00007ffff7bcd3bc in resetCursorRectsForView (theView=<optimized out>) at NSWindow.m:3017 #7  0x00007ffff7bcd3bc in resetCursorRectsForView (theView=<optimized out>) at NSWindow.m:3017 #8  0x00007ffff7bcfba1 in -[NSWindow resetCursorRects] (self=0x55555618aa48, _cmd=<optimized out>) at NSWindow.m:3189 #9  0x00007ffff7bd0ede in -[NSWindow sendEvent:] (self=0x55555618aa48, _cmd=<optimized out>, theEvent=0x55555617c4b8)
    at NSWindow.m:4073
#10 0x00007ffff7a37e6e in -[NSApplication run] (self=0x555555933f48, _cmd=<optimized out>) at NSApplication.m:1585 #11 0x00007ffff7a17dd9 in NSApplicationMain (argc=<optimized out>, argv=<optimized out>) at Functions.m:119
#12 0x00007ffff6c5018a in ?? () from /lib64/libc.so.6
#13 0x00007ffff6c50245 in __libc_start_main () from /lib64/libc.so.6
#14 0x0000555555561171 in _start ()

The splitview is out, but there is still something invalid.


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.

Your fix appears to work


I still wonder if the bug is in GNUstep which shouldn't be "picky" about this delegate or something done in ProjectCenter is fishy, something with the editor instantiation.

Observations:
1) open a project. Do not select any file. There is already a splitview with a generic text scroll view at the bottom. Yet closing the project window now, does not cause issues 2) open a project. select a file so that the editor opens. then from the menu do "close file", the status of 1) returns... and closing makes no issues
3) the fact that nilling the splitview delegates "macht mich stutzig"


Riccardo



reply via email to

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