• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Baffling NSImage crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Baffling NSImage crash


  • Subject: Re: Baffling NSImage crash
  • From: Shamyl Zakariya <email@hidden>
  • Date: Tue, 26 Jun 2007 13:14:17 -0400

I've condensed the crash into a really simple test case, perhaps somebody here can help me out:

This just makes an RGB image that's 100x100 pixels, memsets it to zero, sets the first byte to 255, and then writes it out as a tiff. If I set the first byte to anything other than zero, it crashes.

Unfortunately, XCode's debugger is losing track somehow and doesn't give me a stack trace...

Here's the crashing app:

int main( int agc, const char **argv )
{
    NSApplicationLoad();
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    int width = 100,
        height = 100;

    unsigned char *imageData = malloc( width * height * 3 );
    memset( imageData, 0, width * height * 3 );

    imageData[0] = 255;

NSBitmapImageRep *rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: (void*)imageData
pixelsWide: (float)width
pixelsHigh: (float)height
bitsPerSample: 8
samplesPerPixel: 3
h asAlpha: NO
i sPlanar: NO
colorSpaceName: NSDeviceRGBColorSpace
bitmapFormat: 0
bytesPerRow: width * 3
bitsPerPixel: 24 ];



NSImage *image = [[NSImage alloc] initWithSize: NSMakeSize ( width, height )];
[image addRepresentation: rep];


    NSString *OutputFile = @"../../TestOutput.tif";

// BOOM!
[[image TIFFRepresentation] writeToFile: OutputFile atomically: NO];


    [[NSWorkspace sharedWorkspace] openFile: OutputFile];

    [pool release];
    return 0;
}


email@hidden "yeah, well, that's just like your *opinion*, man." -- the Dude _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Baffling NSImage crash
      • From: Shamyl Zakariya <email@hidden>
References: 
 >Baffling NSImage crash (From: Shamyl Zakariya <email@hidden>)

  • Prev by Date: Re: Adding files to iTune library in Cocoa app
  • Next by Date: Re: Core Data training
  • Previous by thread: Baffling NSImage crash
  • Next by thread: Re: Baffling NSImage crash
  • Index(es):
    • Date
    • Thread