Re: -[NSSet initWithSet:copyItems:] crashing
Re: -[NSSet initWithSet:copyItems:] crashing
- Subject: Re: -[NSSet initWithSet:copyItems:] crashing
- From: j o a r <email@hidden>
- Date: Sat, 5 Mar 2005 18:16:36 +0100
Why did you comment out the interesting line in the code snippet?
Also, could you attach the parts of the HXCell class that would be of
interest from a memory management perspective (the class interface and
the init, dealloc, retain, hash, copy, et.c. methods).
j o a r
On 2005-03-05, at 16.01, Thomas Deniau wrote:
My application crashes with the following backtrace :
Thread 0 Crashed:
0 com.apple.CoreFoundation 0x90192634
__CFDictionaryFindBuckets2 + 0x10
1 com.apple.CoreFoundation 0x90194aa8
_CFDictionaryIncrementValue + 0x38
2 com.apple.Foundation 0x909f0f2c
NSIncrementExtraRefCount + 0x98
3 com.apple.Foundation 0x909f0fec -[NSObject retain]
+ 0x18
4 com.apple.CoreFoundation 0x9019aa18 CFSetAddValue +
0x168
5 com.apple.CoreFoundation 0x901c335c CFSetCreate + 0x50
6 com.apple.Foundation 0x90a528ac -[NSSet
initWithSet:copyItems:] + 0x104
7 com.apple.Foundation 0x90a7a7b8 +[NSSet
setWithSet:] + 0x38
The offending code is :
NSMutableSet *ms=[[NSMutableSet alloc] init];
NSSet *s;
for (int i=0;i<4;i++)
{
HXCell *c=........ // alloc'ed object
[ms addObject:c];
[c release];
}
s=[NSSet setWithSet:ms]; // <--- crashing line
[ms release];
return s;
This code works fine, but say one time out of a million it crashes....
At first I thought it was a thread safety issue (since it doesn't
happen every time), but I've re-engineered my application to use a
single thread and I still got that problem...
MallocDebug tells me that the heap is fine and that this is not a free
problem (MallocScribble).
I've been working on this for two days and I don't understand what's
going on...
Any idea ?
Thanks in advance,
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden