NSImageRGBColorTable crash
NSImageRGBColorTable crash
- Subject: NSImageRGBColorTable crash
- From: David Remahl <email@hidden>
- Date: Mon, 19 Apr 2004 23:22:23 +0200
[[Resend, because the message didn't appear on the list the first
time...]]
Has anyone had any success with using NSImageRGBColorTable to generate
GIFs?
If tmp is a 768 byte file, containing a color lookup table, the
following will crash:
#import <Cocoa/Cocoa.h>
int main( int argc, char **argv ) {
NSAutoreleasePool *autoPool = [[NSAutoreleasePool alloc] init];
NSImage *img = [[NSWorkspace sharedWorkspace]
iconForFile:@"/Applications/Mail.app"];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setObject:[NSData dataWithContentsOfFile:@"/tmp/clut"]
forKey:NSImageRGBColorTable];
[NSBitmapImageRep representationOfImageRepsInArray:[img
representations] usingType:NSGIFFileType properties:dict];
return 0;
}
test:
% python -c 'f=open("/tmp/clut","w"); f.write("\xff"*768); f.close()' #
create a 768 byte file filled with FF.
% gcc -framework Cocoa main.m test
% ./test
Segmentation fault
The backtrace looks like this:
Thread 0 Crashed:
0 com.apple.AppKit 0x92fce800 ComputeDither + 0x44
1 com.apple.AppKit 0x92fcebcc InitDitherTable +
0x48
2 com.apple.AppKit 0x92fcef84 _NSCompressGIFImage
+ 0x78
3 com.apple.AppKit 0x93074a18 -[NSGIFImageWriter
representationWithImageProperties:withProperties:] + 0x368
4 com.apple.AppKit 0x92ffa474 -
-[NSBitmapImageRep(NSBitmapImageFileTypeExtensions)
representationUsingType:properties:] + 0x368
Any ideas?
/ Regards, David Remahl
--- PGP key information---
pub 1024D/ 87256085 2003/06/12 David Remahl <email@hidden>
Web:
http://ittpoi.com/david_remahl.asc
Fingerprint: 0C38 293C 86A9 7756 9CEA 4ED6 1651 620E 8725 6085
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.