Re: Thematic Crash - hard to debug

Fred Kiefer <[email protected]>
Newsgroups gmane.comp.lib.gnustep.devel
Message-ID <[email protected]>
The lines that the debugger reports look like this:



if ([[img image] size].width > 64
        || [[img image] size].height > 64)

The most likely reason for a crash here is [img image] being nil. Just add a check for this condition a few lines above and see what happens.

Hope this helps,
Fred

> Am 16.12.2020 um 16:56 schrieb Riccardo Mottola <[email protected]>:
> 
> Hello,
> 
> I am suffering a crash im Thematic as soon as I open the image inspector
> of the theme. It happens on NetBSD/x86-32 with the gcc runtime.
> - I am unable to get the libobjc2 runtime working on NetBSD yet, so no
> comparison
> - on Linux, both 32bit and 64bit, gcc or libobjc2 runtime I do not have
> the issue nor does running valgrind show any useful result
> - valgrind is not available on NetBSD
> 
> I get this if compiled with -O2
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0xae562bde in objc_msg_lookup () from /usr/lib/libobjc.so.4
> (gdb) bt
> #0  0xae562bde in objc_msg_lookup () from /usr/lib/libobjc.so.4
> #1  0x08055402 in -[ImagesView refreshCells] (self=<optimized out>,
>     _cmd=0x8058f6f <-[ImageElement initWithView:owner:]+10162>) at
> ImageElement.m:354
> #2  0xab02c110 in ?? ()
> Backtrace stopped: previous frame inner to this frame (corrupt stack?)
> 
> I compiled all GNUstep core in debug mode without -O2, but that doesn't
> help getting a better stacktrace, but no help.
> If I compile Thematic without -O2, I get no crash!
> 
> Thus I suppose there is a memory error which gets hidden without
> optimization (addign lots of data can hide off-by one errors or such)
> and that it is in Thematic but not in gnustep base/gui.
> 
> I tried compiling then -O1 and I think I finally obtain a useful stacktrace:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0xacc13be4 in objc_msg_lookup () from /usr/lib/libobjc.so.4
> (gdb) bt
> 
> 
> #0  0xb6cbdbe4 in objc_msg_lookup () from /usr/lib/libobjc.so.4
> #1  0x08055467 in -[ImagesView refreshCells] (self=0x8054ef9
> <-[ImagesView addObject:]+158>,
>     _cmd=0xb3787290) at ImageElement.m:348
> #2  0x08073248 in _OBJC_SELECTOR_TABLE ()
> #3  0x08054ef9 in -[ImagesView addObject:] (self=0xb3787290,
>     _cmd=0x8073330 <_OBJC_SELECTOR_TABLE+1136>, anObject=0xb2686100) at
> ImageElement.m:172
> #4  0x08058fa1 in -[ImageElement initWithView:owner:] (self=<optimized
> out>,
>     _cmd=0x806fc98 <_OBJC_SELECTOR_TABLE+1368>, aView=0xb380e410,
> aDocument=0xb28260f0)
>     at ImageElement.m:544
> #5  0x0804d5d3 in -[ThemeDocument elementForView:] (self=0xb28260f0,
>     _cmd=0x806fbf0 <_OBJC_SELECTOR_TABLE+1200>, aView=0xb380e410) at
> ThemeDocument.m:472
> #6  0x0804b86b in -[ThemeDocument changeSelection:at:] (self=0xb28260f0,
>     _cmd=0x806fb60 <_OBJC_SELECTOR_TABLE+1056>, aView=0xb380e410,
> mousePoint=...)
>     at ThemeDocument.m:316
> #7  0x0804d113 in -[ThemeDocumentView mouseDown:] (self=0xb2731b70,
>     _cmd=0xb7789150 <_OBJC_SELECTOR_TABLE+3568>, theEvent=0xb27e67d0) at
> ThemeDocument.m:207
> #8  0xb753bf2f in -[NSWindow sendEvent:] (self=0xb26fba10,
>     _cmd=0xb76b3cd0 <_OBJC_SELECTOR_TABLE+2448>, theEvent=0xb27e67d0) at
> NSWindow.m:4154
> #9  0xb7334d22 in -[NSApplication sendEvent:] (self=0xb3710e10,
>     _cmd=0xb76b3c08 <_OBJC_SELECTOR_TABLE+2248>, theEvent=0xb27e67d0) at
> NSApplication.m:2148
> #10 0xb733336c in -[NSApplication run] (self=0xb3710e10, _cmd=0xb76a67c8
> <_OBJC_SELECTOR_TABLE+936>)
>     at NSApplication.m:1585
> #11 0xb730f48d in NSApplicationMain (argc=argc@entry=1,
> argv=argv@entry=0xbfb336c8) at Functions.m:123
> #12 0x0806592e in gnustep_base_user_main (argc=1, argv=0xbfb336c8) at
> main.m:31
> #13 0xb6ef431f in main (argc=1, argv=0xbfb336c8, env=0xbfb336d0) at
> NSProcessInfo.m:1008
> #14 0x0804a056 in ___start ()
> #15 0x08049d87 in _start ()
> 
> I set NSZombieEnabled=YES but I get a crash anyway! usually that should
> save from such situations?
> 
> Riccardo
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.