discuss-gnustep
[Top][All Lists]
Advanced

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

Re : Segmentation fault in NSCell


From: Mathieu Suen
Subject: Re : Segmentation fault in NSCell
Date: Tue, 7 Feb 2012 13:56:58 +0000 (GMT)

Hi Lucas

My guess is:
0xdeadface = dead face?

The pointer is already freed.
What did you do before the call to  [super dealloc] ?

--
Mathieu


De : Lucas Schnorr <address@hidden>
À : GNUstep Discuss <address@hidden>
Envoyé le : Mardi 7 février 2012 13h50
Objet : Segmentation fault in NSCell

Hi,

I have a subclass of NSCell called PieCell. Its dealloc method, at the
end, calls [super dealloc] as usual. The application code, GNUstep and
the runtime [1] were compiled with Clang. During the execution of
NSCell's dealloc method, GDB detects a segmentation fault inside the
libobjc2 runtime [1] at line sendmsg2.c:60.

The value of the 'class' variable is
(gdb) p class
$14 = (Class) 0xdeadface

The last call inside GUI is at this line
gnustep/core/gui/Source/NSCell.m:224

The value of _formatter attribute at this moment is
(gdb) p *_formatter
$9 = {<> = {isa = 0xdeadface}, <No data fields>}

What does 0xdeadface mean? The object was already freed? I'm trying to
fix this segfault, and I suspect that this might be related to the
code I have here (the PieCell class and the rest). But since I'm not
completely sure about this, and I wasn't able to find the problem yet,
I am posting to see if you guys have any clues.

Here's the complete backtrace:

#0  0x00007ffff639b1e3 in objc_msg_lookup_internal (receiver=<optimized out>,
    selector=<optimized out>, sender=<optimized out>,
    receiver=<optimized out>, selector=<optimized out>, sender=<optimized out>)
    at sendmsg2.c:60
#1  objc_msg_lookup (receiver=0xc1d608, selector=0x7ffff7960880)
    at sendmsg2.c:375
#2  0x00007ffff734ae41 in -[NSCell dealloc] (self=0x1200988,
    _cmd=0x7fffebad3350)
    at /home/schnorr/misc/gnustep/core/gui/Source/NSCell.m:224
#3  0x00007fffeb8c1955 in -[PieCell dealloc] (self=0x1200988,
    _cmd=0x7ffff6eb62a0) at PieCell.m:329
#4  0x00007ffff697bf2f in -[NSObject release] (self=0x1200988,
    _cmd=0x7ffff6e57680)
    at /home/schnorr/misc/gnustep/core/base/Source/NSObject.m:2058
#5  0x00007ffff67e4c32 in -[GSArray dealloc] (self=0x11d7d08,
    _cmd=0x7ffff6eb62a0)
    at /home/schnorr/misc/gnustep/core/base/Source/GSArray.m:136
#6  0x00007ffff697bf2f in -[NSObject release] (self=0x11d7d08,
    _cmd=0x7ffff6e73790)
    at /home/schnorr/misc/gnustep/core/base/Source/NSObject.m:2058
#7  0x00007ffff686473c in -[NSAutoreleasePool emptyPool] (self=0xafcad8,
    _cmd=0x7ffff6e73760)
    at /home/schnorr/misc/gnustep/core/base/Source/NSAutoreleasePool.m:656
#8  0x00007ffff68642c8 in -[NSAutoreleasePool dealloc] (self=0xafcad8,
    _cmd=0x7ffff6e73800)
    at /home/schnorr/misc/gnustep/core/base/Source/NSAutoreleasePool.m:538
#9  0x00007ffff686418e in -[NSAutoreleasePool drain] (self=0xafcad8,
    _cmd=0x7ffff7a17c80)
    at /home/schnorr/misc/gnustep/core/base/Source/NSAutoreleasePool.m:519
#10 0x00007ffff75a5432 in -[NSWindow close] (self=0x115bf98,
    _cmd=0x7ffff7948f60)
    at /home/schnorr/misc/gnustep/core/gui/Source/NSWindow.m:2739
#11 0x00007ffff697bb30 in -[NSObject performSelector:] (self=0x115bf98,
    _cmd=0x7ffff6e57730, aSelector=0x7ffff7948f60)
    at /home/schnorr/misc/gnustep/core/base/Source/NSObject.m:1984
#12 0x00007ffff67e58f6 in -[GSArray makeObjectsPerformSelector:] (
    self=0xd52558, _cmd=0x7ffff79495b0, aSelector=0x7ffff7948f60)
    at /home/schnorr/misc/gnustep/core/base/Source/GSArray.m:342
#13 0x00007ffff72f968c in -[NSApplication replyToApplicationShouldTerminate:] (
    self=0xa62d28, _cmd=0x7ffff794a3d0, shouldTerminate=1 '\001')
    at /home/schnorr/misc/gnustep/core/gui/Source/NSApplication.m:3487
#14 0x00007ffff72f9440 in -[NSApplication terminate:] (self=0xa62d28,
    _cmd=0x69c260, sender=0xf12778)
    at /home/schnorr/misc/gnustep/core/gui/Source/NSApplication.m:3463
#15 0x00007ffff72f45c6 in -[NSApplication sendAction:to:from:] (self=0xa62d28,
    _cmd=0x7ffff79a6860, aSelector=0x69c260, aTarget=0x0, sender=0xf12778)
    at /home/schnorr/misc/gnustep/core/gui/Source/NSApplication.m:2232
#16 0x00007ffff7432851 in -[NSMenu performActionForItemAtIndex:] (
    self=0xefd088, _cmd=0x7ffff79a8600, index=9)
    at /home/schnorr/misc/gnustep/core/gui/Source/NSMenu.m:1321
#17 0x00007ffff7440e83 in -[NSMenuView
performActionWithHighlightingForItemAtIndex:] (self=0xf49c28,
_cmd=0x7ffff79a5f80, index=9)
    at /home/schnorr/misc/gnustep/core/gui/Source/NSMenuView.m:1399
#18 0x00007ffff74323f5 in -[0xdeadfaceNSMenu performKeyEquivalent:]
(self=0xefd088,
    _cmd=0x7ffff79495e0, theEvent=0x11f94f8)
    at /home/schnorr/misc/gnustep/core/gui/Source/NSMenu.m:1279
#19 0x00007ffff72f3ae0 in -[NSApplication sendEvent:] (self=0xa62d28,
    _cmd=0x7ffff7948ee0, theEvent=0x11f94f8)
    at /home/schnorr/misc/gnustep/core/gui/Source/NSApplication.m:2078
#20 0x00007ffff72f1928 in -[NSApplication run] (self=0xa62d28,
    _cmd=0x7ffff793e190)
    at /home/schnorr/misc/gnustep/core/gui/Source/NSApplication.m:1564
#21 0x00007ffff72bb4ac in NSApplicationMain (argc=2, argv=0x7fffffffdb88)
    at /home/schnorr/misc/gnustep/core/gui/Source/Functions.m:91
#22 0x000000000040a402 in main (argc=2, argv=0x7fffffffdb88) at Paje_main.m:24

Thanks
Lucas

[1]: latest version from http://svn.gna.org/svn/gnustep/libs/libobjc2/trunk

_______________________________________________
Discuss-gnustep mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnustep



reply via email to

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