• 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
Crash drawing image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Crash drawing image


  • Subject: Crash drawing image
  • From: "email@hidden" <email@hidden>
  • Date: Sat, 24 Oct 2009 15:51:03 +0200

Hello!

I'm getting a random “EXC_BAD_ACCESS” on this line:

[sourceImage compositeToPoint:NSMakePoint(0, height) operation:NSCompositeCopy];

sourceImage is an iTunes artwork, or a generic artwork icon if the
current track has none. The crash ONLY happens with this generic icon
(and only at random). The (retained) image is valid at the time of the
crash and looks like this:

<NSImage 0x2003c7140 Size={600, 600} Reps=(
    "NSBitmapImageRep 0x2004295c0 Size={600, 600} ColorSpace=iMac
colorspace BPS=8 BPP=24 Pixels=600x600 Alpha=NO Planar=NO Format=0
CurrentBacking=<CGImageRef: 0x2003c4f60> CGImageSource=0x2000af320"
)>

Here's my full code:

+ (NSImage *)appendReflectionToImage:(NSImage *)sourceImage
fraction:(float)fraction
{
	NSSize size = [sourceImage size];
	float width = size.width;
	float height = size.height * fraction;
	NSImage *reflection = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
	[reflection setFlipped:YES];

	[reflection lockFocus];
	[sourceImage drawAtPoint:NSZeroPoint fromRect:NSZeroRect
operation:NSCompositeSourceOver fraction:1.0];
	NSGradient *gradient = [[NSGradient alloc]
initWithStartingColor:[NSColor colorWithDeviceWhite:0.0 alpha:0.5]
endingColor:[NSColor colorWithDeviceWhite:0.0 alpha:1.0]];
	[gradient drawInRect:NSMakeRect(0, 0, width, height) angle:90];
	[reflection unlockFocus];

	NSImage *destinationImage = [[NSImage alloc]
initWithSize:NSMakeSize(width, size.height + height)];

	[destinationImage lockFocus];
	[reflection compositeToPoint:NSZeroPoint operation:NSCompositeCopy];
	[sourceImage compositeToPoint:NSMakePoint(0, height)
operation:NSCompositeCopy]; // CRASHES HERE, ALWAYS SAME IMAGE
	[destinationImage unlockFocus];
	[destinationImage setScalesWhenResized:YES];

	return destinationImage;
}

The project is a (GC enabled) screen saver, which makes it kind of
hard to debug. I'm running it attached to the Screen Saver Engine.
When the crash happens, I get the spinning beach ball until I
terminate the process, so I cannot investigate it any further (I
think?). Anyway, this is what I get from the debugger:

Program received signal:  “EXC_BAD_ACCESS”.
Error while running hook_stop:
Error while running hook_stop:
Invalid type combination in ordering comparison.
Error while running hook_stop:
Invalid type combination in ordering comparison.
Error while running hook_stop:
Error while running hook_stop:
Error while running hook_stop:
Error while running hook_stop:
Error while running hook_stop:
Error while running hook_stop:
Error while running hook_stop:

Unable to disassemble ripc_RemoveEntry.

Any ideas what the problem might be? I never had this crash before
enabling GC (but have also altered the code above since then so this
might not mean anything). Thank you.

F.
_______________________________________________

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: Crash drawing image
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Force subviews to stay in place during live resize
  • Next by Date: Re: Force subviews to stay in place during live resize
  • Previous by thread: Re: Force subviews to stay in place during live resize
  • Next by thread: Re: Crash drawing image
  • Index(es):
    • Date
    • Thread