apps-gworkspace icon indicating copy to clipboard operation
apps-gworkspace copied to clipboard

reproducible crasher creating many files in ~/Desktop

Open buzzdeee opened this issue 3 years ago • 3 comments

I'm on OpenBSD amd64, and when I run the following in ~/Desktop

for I in $(jot 255);do touch $I.txt;done

running latest released versions of gnustep-base, gui, and back, GWorkspace 1.0.0, but the crasher also initially observed in the prior version.

GWorkspace crashes with following backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x0000012f5a209a56 in -[GWDesktopView tile] (self=0x131f3271808, _cmd=0x12f5a2c8ec0 <objc_selector_list+1184>) at Desktop/GWDesktopView.m:222
222           if (NSEqualRects(grid[index], [icon frame]) == NO) {
(gdb) bt
#0  0x0000012f5a209a56 in -[GWDesktopView tile] (self=0x131f3271808, _cmd=0x12f5a2c8ec0 <objc_selector_list+1184>) at Desktop/GWDesktopView.m:222
#1  0x0000012f5a2100be in -[GWDesktopView(NodeRepContainer) watchedPathChanged:] (self=0x131f3271808, _cmd=0x12f5a2bb9c8 <objc_selector_list+2208>, info=0x131bb3f3988) at Desktop/GWDesktopView.m:1244
#2  0x0000012f5a20557f in -[GWDesktopManager watcherNotification:] (self=0x131bc228e08, _cmd=0x12f5a2bb9d8 <objc_selector_list+2224>, notif=0x131b9b204c8) at Desktop/GWDesktopManager.m:551
#3  0x00000131d02b89fe in -[NSObject performSelector:withObject:] (self=0x131bc228e08, _cmd=0x131d04c2318 <objc_selector_list+464>, aSelector=0x12f5a2bb9d8 <objc_selector_list+2224>, 
    anObject=0x131b9b204c8) at NSObject.m:2022
#4  0x00000131d02a1729 in -[NSNotificationCenter _postAndRelease:] (self=0x1320c42dfc8, _cmd=0x131d04c2268 <objc_selector_list+288>, notification=0x131b9b204c8) at NSNotificationCenter.m:1198
#5  0x00000131d02a1ef5 in -[NSNotificationCenter postNotificationName:object:userInfo:] (self=0x1320c42dfc8, _cmd=0x131d04c2328 <objc_selector_list+480>, name=0x12f5a2a7fd0 <objc_str>, 
    object=0x131bb3f3988, info=0x0) at NSNotificationCenter.m:1273
#6  0x00000131d02a1dd3 in -[NSNotificationCenter postNotificationName:object:] (self=0x1320c42dfc8, _cmd=0x12f5a2ab870 <objc_selector_list+5440>, name=0x12f5a2a7fd0 <objc_str>, object=0x131bb3f3988)
    at NSNotificationCenter.m:1253
#7  0x0000012f5a1f6528 in -[GWorkspace watchedPathDidChange:] (self=0x1317fd98c08, _cmd=0x132540c4a90 <objc_selector_list+1040>, dirinfo=0x131b9b22688) at GWorkspace.m:1856
#8  0x000001321f810b8d in ffi_call_unix64 () from /usr/local/lib/libffi.so.1.2
#9  0x000001321f81025d in ffi_call_int () from /usr/local/lib/libffi.so.1.2
#10 0x00000131d03d4918 in GSFFIInvokeWithTargetAndImp (inv=0x132258ed788, anObject=0x1317fd98c08, imp=0x12f5a1f63b0 <-[GWorkspace watchedPathDidChange:]>) at GSFFIInvocation.m:370
#11 0x00000131d03d4f2a in -[GSFFIInvocation invokeWithTarget:] (self=0x132258ed788, _cmd=0x131d04aa068 <objc_selector_list+224>, anObject=0x1317fd98c08) at GSFFIInvocation.m:452
#12 0x00000131d026c188 in -[NSInvocation invoke] (self=0x132258ed788, _cmd=0x131d04851c0 <objc_selector_list+464>) at NSInvocation.m:673
#13 0x00000131d01ec7b0 in -[NSConnection(Private) _service_forwardForProxy:] (self=0x131908f2e08, _cmd=0x131d0485400 <objc_selector_list+1040>, aRmc=0x13181487208) at NSConnection.m:2721
#14 0x00000131d01ea9a0 in -[NSConnection(Private) handlePortMessage:] (self=0x1323c430a08, _cmd=0x131d0536408 <objc_selector_list+768>, msg=0x131b9b20508) at NSConnection.m:2320
#15 0x00000131d03c2f86 in -[NSMessagePort handlePortMessage:] (self=0x13247c4ffc8, _cmd=0x131d0536408 <objc_selector_list+768>, m=0x131b9b20508) at NSMessagePort.m:1581
#16 0x00000131d03bfc42 in -[GSMessageHandle receivedEvent:type:extra:forMode:] (self=0x131908f2808, _cmd=0x131d0536638 <objc_selector_list+1328>, data=0x13247c4ffc8, type=ET_RPORT, extra=0x13, 
    mode=0x131d04e6ad0 <objc_str>) at NSMessagePort.m:884
#17 0x00000131d03c3824 in -[NSMessagePort receivedEvent:type:extra:forMode:] (self=0x13247c4ffc8, _cmd=0x131d0565af0 <objc_selector_list+368>, data=0x13247c4ffc8, type=ET_RPORT, extra=0x13, 
    mode=0x131d04e6ad0 <objc_str>) at NSMessagePort.m:1710
#18 0x00000131d0428fab in -[GSRunLoopCtxt pollUntil:within:] (self=0x131b4235e08, _cmd=0x131d04e7d70 <objc_selector_list+1216>, milliseconds=1482, contexts=0x131bb3cb308) at GSRunLoopCtxt.m:600
#19 0x00000131d030bf5c in -[NSRunLoop acceptInputForMode:beforeDate:] (self=0x131bb3d7a48, _cmd=0x131d04e7cb0 <objc_selector_list+1024>, mode=0x131d04e6ad0 <objc_str>, limit_date=0x13211ffd328)
    at NSRunLoop.m:1254
#20 0x00000131d030c4a7 in -[NSRunLoop runMode:beforeDate:] (self=0x131bb3d7a48, _cmd=0x132362c3198 <objc_selector_list+736>, mode=0x131d04e6ad0 <objc_str>, date=0x131d2a02d68) at NSRunLoop.m:1334
#21 0x000001323600f085 in -[GSDisplayServer(EventOps) getEventMatchingMask:beforeDate:inMode:dequeue:] (self=0x131bb3ce808, _cmd=0x131bcce7f80, mask=4294967295, limit=0x131d2a02d68, 
    mode=0x131d04e6ad0 <objc_str>, flag=1 '\001') at GSDisplayServer.m:1041
#22 0x0000013235d96b88 in DPSGetEvent (ctxt=0x131bb3ce808, mask=4294967295, limit=0x131d2a02d68, mode=0x131d04e6ad0 <objc_str>) at ../Headers/Additions/GNUstepGUI/GSDisplayServer.h:201
#23 0x0000013235d9798a in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] (self=0x13221e39208, _cmd=0x132360ef480 <objc_selector_list+5072>, mask=4294967295, 
    expiration=0x131d2a02d68, mode=0x131d04e6ad0 <objc_str>, flag=1 '\001') at NSApplication.m:2202
#24 0x0000013235d95b52 in -[NSApplication run] (self=0x13221e39208, _cmd=0x12f5a29ac20 <objc_selector_list+48>) at NSApplication.m:1576
#25 0x0000012f5a1e8873 in gnustep_base_user_main (argc=1, argv=0x7f7ffffcdf88, env=0x7f7ffffcdf98) at main.m:38
#26 0x00000131d02f0467 in main (argc=1, argv=0x7f7ffffcdf88, env=0x7f7ffffcdf98) at NSProcessInfo.m:1008
#27 0x0000012f5a1e85b8 in _start ()
(gdb) frame 0
#0  0x0000012f5a209a56 in -[GWDesktopView tile] (self=0x131f3271808, _cmd=0x12f5a2c8ec0 <objc_selector_list+1184>) at Desktop/GWDesktopView.m:222
222           if (NSEqualRects(grid[index], [icon frame]) == NO) {
(gdb) print index
$1 = -1
(gdb) print grid[index]
$2 = {origin = {x = 0, y = 0}, size = {width = 0, height = 0}}
(gdb) print [icon frame]
$3 = {origin = {x = 0, y = 0}, size = {width = 64, height = 70}}
(gdb) list
217       for (i = 0; i < [icons count]; i++) {
218         FSNIcon *icon = [icons objectAtIndex: i];
219         int index = [icon gridIndex];
220       
221         if (index < gridcount) {
222           if (NSEqualRects(grid[index], [icon frame]) == NO) {
223             [icon setFrame: grid[index]];
224           }
225         } else {
226           int freeindex = [self firstFreeGridIndex];
(gdb) print index
$4 = -1
(gdb) print gridcount
$5 = 1512865688

Maybe an NS(U)Integer vs. int problem, or something within the logic. I tried to move everything to NSUInteger and the -1 to NSNotFound, but that didn't work out, maybe must have overlooked something, or well, it's somewhere in the logic.

buzzdeee avatar Jan 01 '22 21:01 buzzdeee

A wild guess could be that there is no place left on the desktop, so no index on the grid? need to look more at it.

rmottola avatar Apr 17 '24 18:04 rmottola

@buzzdeee I think the transition to NSUInteger requires much more work... it may be related though, since the situation is quited mixed. I started a branch to work on it: https://github.com/gnustep/apps-gworkspace/tree/NSUInteger_Index

see latest commit: https://github.com/gnustep/apps-gworkspace/commit/7b0d1668192bd068c107f03ce4338a061d5c48ed

please test? I already found some bugs. Certain indexes cannot be made unsigned for the way the code is written, I need to think about it. Moving icons on the desktop causes a hang. I fear somewhere the code relied on negative values more than just not found, or perhaps I missed something. Do you spot it?

rmottola avatar Apr 18 '24 00:04 rmottola

I worked more, rewriting some loops. Now I don't have issues creating many files on the desktop with your script, even running it twice. However, when removing the files gradually, I notice that certain icons have no label displayed! Mystery! Clues?

rmottola avatar Apr 23 '24 00:04 rmottola

Should be fixed, works for me now, @buzzdeee .

rmottola avatar May 28 '24 00:05 rmottola