Crash in CFReadStream Callback
Crash in CFReadStream Callback
- Subject: Crash in CFReadStream Callback
- From: Trygve Inda <email@hidden>
- Date: Sat, 02 Apr 2005 10:54:52 +0000
I have a CFReadStream pulling back a jpg file over HTTP.
In some cases I do not have a header to determine the size.
cfHeaderField = CFHTTPMessageCopyHeaderFieldValue (cfHeader,
CFSTR("Content-Length"));
In this situation I tried to allocate a buffer and keep increasing its size
as bytes are returned...
bytesRead = CFReadStreamRead (stream, buffer, sizeof(buffer));
if (bytesRead > 0)
{
if (noHeaderSize)
{
SetPtrSize (dInfo->mBuffer, dInfo->mContentRead + bytesRead);
}
BlockMoveData (buffer, dInfo->mBuffer + dInfo->mContentRead, bytesRead);
dInfo->mContentRead += bytesRead;
This seems to crash deep in the OS...
Thread 0 Crashed:
0 libSystem.B.dylib 0x9000239c szone_calloc + 0xdc
1 libSystem.B.dylib 0x90002ce4 malloc_zone_calloc + 0xc4
2 libSystem.B.dylib 0x900036ac calloc + 0x4c
3 ...ple.CoreServices.CarbonCore 0x90281f6c CSMemNewPtrClear + 0x38
4 ...ple.CoreServices.CarbonCore 0x90282950 CSMemNewHandleClear + 0x34
5 com.apple.QD 0x915622fc NewRgn + 0x64
6 com.apple.HIToolbox 0x927dba70
HIView::DrawInternal(short, OpaqueGrafPtr*, OpaqueRgnHandle*, unsigned char,
unsigned char, unsigned char, HIView*, CGContext*) + 0x16c
7 com.apple.HIToolbox 0x927dcbf0 HIView::Draw(short,
OpaqueGrafPtr*, OpaqueRgnHandle*, unsigned long, HIView*, CGContext*) +
0x318
8 com.apple.HIToolbox 0x92809f88
HIProgressBar::AnimationTimer(__EventLoopTimer*) + 0x164
9 com.apple.CoreFoundation 0x90194618 __CFRunLoopDoTimer + 0xf4
10 com.apple.CoreFoundation 0x90191978 __CFRunLoopRun + 0x5c8
11 com.apple.CoreFoundation 0x90195e8c CFRunLoopRunSpecific +
0x148
I get other crashes as well - very random and hard to figure out. Any
thoughts here? Could it have to do with opening a Modal Window while the
HTTP transfer is happening?
I am wondering if the Window's modal loop is conflicting with the
CFRunLoopGetCurrent. I also have another rendering thread running at the
same tme.
CFReadStreamScheduleWithRunLoop (dInfo->mReadStreamRef,
CFRunLoopGetCurrent(), kCFRunLoopCommonModes);
Ideas?
Thanks,
Trygve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden