discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Re : Segmentation fault in NSCell


From: Fred Kiefer
Subject: Re: Re : Segmentation fault in NSCell
Date: Tue, 07 Feb 2012 19:55:58 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111220 Thunderbird/9.0

On 07.02.2012 15:22, Lucas Schnorr wrote:
On Tue, Feb 7, 2012 at 14:56, Mathieu Suen<address@hidden>  wrote:
My guess is:
0xdeadface = dead face?
The pointer is already freed.

Yes, this is definitely a double free isue. You are freeing an object that was already deallocated.

What did you do before the call to  [super dealloc] ?

Before the [super dealloc], the code frees PieCell attributes.

I think I may have found the problem. I have a NSMatrix (of PieCells)
that is loaded from a gorm/nib resource in the awakeFromNib method of
the class that manages the matrix. In the dealloc method of this
manager class, the code does:

[matrix removeFromSuperview];

And I think I'm not supposed to do that, if the matrix variable points
to an instance that was loaded from a gorm file. If I remove this
line, it works - the segfault disappears, but I'm not sure if there
isn't memory leaks.

This may not be the root cause, it should be OK the remove the matrix from the view hierarchy (Depending on how it got created). But if it works as a work around you might live with it. Otherwise you will have to provide more of your code to analyse.

If you want to go deeper, you should send the code where you create the matrix and the code where you create the PieCell. Is the PieCell the cell prototype for the matrix? And are you dealing with an array of cells somewhere in your application? That code might be of interest as well.

Fred



reply via email to

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