discuss-gnustep
[Top][All Lists]
Advanced

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

Re: signal SIGSEGV, Segmentation fault


From: Wolfgang Lux
Subject: Re: signal SIGSEGV, Segmentation fault
Date: Tue, 22 May 2018 14:03:17 +0200


> Am 22.05.2018 um 13:54 schrieb Andreas Höschler <ahoesch@smartsoft.de>:
> 
> Hi Wolfgang,
> 
>>> Any further ideas?
>> 
>> Looking back at your initial report, it has this telling line about the 
>> crash:
>> 
>> Thread 1 "TimberNav" received signal SIGSEGV, Segmentation fault.
>> -[MapView drawRect:] (self=0xb7ca746e <-[NSView 
>> displayRectIgnoringOpacity:inContext:]+318>,
>>    _cmd=0x8a704b8, rect=...) at MapView.m:168
>> 168           NSLog(@"routeVisible: %d", _routeVisible);
>> (gdb)
>> 
>> The self parameter in the call is a pointer into the code area of the 
>> program. So it looks like a serious memory management issue in your program 
>> where the MapView object that you intended to call the drawRect: method on 
>> has been released already and its memory been overwritten by some other code.
> 
> How do you see that the self pointer points to code area?

From the self pointer in the call frame:
  self=0xb7ca746e <-[NSView displayRectIgnoringOpacity:inContext:]+318>
gdb resolves this address to an address in the code of the 
displayRectIgnoringOpacity:inContext: method from the NSView class. :-)

> I have added a retain in the init method of MapView (dirty hack)
> 
> - (id)initWithFrame:(NSRect)frameRect
> {
>    NSLog(@"initWithFrame ...");
>    self = [super initWithFrame: frameRect];
>    [self retain];
>    ...
> }
> 
> to check your proposition and also did
> 
> - (void)dealloc
> {
>    NSLog(@"MapView dealloc");
>    ...
>    [super dealloc];
> }
> 
> This changed nothing. The program still crashes at the same spot and MapView 
> is never deallocated (at least dealloc not called)!? And remember, the app 
> works perfectly well in two other environments (for whatever that's worth).

With the same version of gnustep-base and gnustep-gui?

> Perhaps adding NSZombieEnabled=YES to the environment before running your 
> program might already give you a clue.
> 
> You mean
> 
>       export NSZombieEnabled=YES
>       openapp <application>

Yes.

Wolfgang





reply via email to

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