• 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
[Leopard] CIContext thread safety [was: CGContextDrawShading crash a known problem?]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Leopard] CIContext thread safety [was: CGContextDrawShading crash a known problem?]


  • Subject: [Leopard] CIContext thread safety [was: CGContextDrawShading crash a known problem?]
  • From: Pierre Bernard <email@hidden>
  • Date: Thu, 6 Dec 2007 18:48:25 +0100

Hi!

It appears that the crash I am seeing is related to multithreading. If I use Core Images concurrently on different threads, I seem to be begging for trouble. This worked just fine on Tiger.

Pierre

On Dec 5, 2007, at 2:09 PM, Pierre Bernard wrote:

Hi!

I am seeing occasional crashes in CGContextDrawShading on Leopard. The very same code worked fin on Tiger.

#0 0x939ef41b in x_list_length
#1 0x939ef31b in fe_kernel_new_with_kernel
#2 0x939fb6e7 in fe_kernel_concat
#3 0x939fb365 in fe_tree_merge_apply
#4 0x939fb1e7 in fe_tree_merge_kernels_1
#5 0x939fae3f in fe_tree_merge_kernels_1
#6 0x939fae3f in fe_tree_merge_kernels_1
#7 0x939fad41 in fe_tree_merge_kernels
#8 0x939f6166 in fe_tree_prepare_tree_
#9 0x939f4a10 in fe_tree_render_image
#10 0x939f42bc in fe_image_render_
#11 0x93a4d0e9 in fe_image_render
#12 0x93b0232e in renderImage
#13 0x93a4b76f in -[CIOpenGLContextImpl renderWithBounds:matrix:function:info:]
#14 0x93a4b696 in -[CIContextImpl render:]
#15 0x16a4d769 in cgxcoreimage_instance_render
#16 0x925d5df2 in CGXCoreImageInstanceRender
#17 0x900e1e29 in ripc_AcquireCoreImage
#18 0x900c6faf in ripc_DrawShading
#19 0x925d5b53 in CGContextDrawShading
#20 0x939f1ec7 in -[CICGContextImpl render:]
#21 0x939f1948 in -[CIContext drawImage:inRect:fromRect:]
#22 0x00020373 in -[CIImage(HSExtensions) cgImage] at CIImage +HSExtensions.m:148
#23 0x000203c5 in -[CIImage(HSExtensions) writeToURL:ofType:metadata:error:] at CIImage+HSExtensions.m:161
#24 0x0001f21e in +[NSImage(HSExtensions) scaleAndSaveAsJPEG:maxSize:quality:saveTo:] at NSImage +HSExtensions.m:308
#25 0x00037bdc in -[GoogleEarthExport writeImages:] at GoogleEarthExport.m:940
#26 0x0002e660 in -[SIWorkUnit performWork] at SIWorkUnit.m:45
#27 0x0002e3cc in -[SIWorkThread workLoop:] at SIWorkThread.m:47
#28 0x956da04d in -[NSThread main]
#29 0x956d9bf4 in __NSThread__main__
#30 0x938ba075 in _pthread_start
#31 0x938b9f32 in thread_start


- (CGImageRef) cgImage
{
   size_t height = [self extent].size.height;
   size_t width = [self extent].size.width;
   CGRect rect = {{0,0}, {width, height}};
   size_t bitsPerComponent = 8;
   size_t bytesPerRow = width*4;
   CGImageAlphaInfo alphaInfo = kCGImageAlphaPremultipliedLast;

   CGContextRef context = CGBitmapContextCreate(nil, width, height,
												 bitsPerComponent, bytesPerRow,
												 CGColorSpaceCreateDeviceRGB(), alphaInfo);
	NSMutableDictionary *options = [NSDictionary dictionary];

#ifndef NSAppKitVersionNumber10_4
#define NSAppKitVersionNumber10_4 824
#endif

if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_4)
{
[options setObject:[NSNumber numberWithBool:YES] forKey:kCIContextUseSoftwareRenderer];
}

CIContext *ciContext = [CIContext contextWithCGContext:context options:options];

CGColorSpaceRef graySpace = CGColorSpaceCreateDeviceGray();
const float whiteComps[2] = {1.0, 1.0};
CGColorRef whiteColor = CGColorCreate(graySpace, whiteComps);
CFRelease(graySpace);
CGContextSetFillColorWithColor(context, whiteColor);
CGContextFillRect(context, rect);
CFRelease(whiteColor);

CGRect extent = [self extent];

[ciContext drawImage:self inRect:rect fromRect:extent];

CGImageRef image = CGBitmapContextCreateImage(context);

CGContextRelease(context);

return image;
}


Pierre
---
Pierre Bernard
http://www.bernard-web.com/pierre
http://www.houdah.com



_______________________________________________

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

--- Pierre Bernard http://www.bernard-web.com/pierre http://www.houdah.com



_______________________________________________

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: [Leopard] CIContext thread safety [was: CGContextDrawShading crash a known problem?]
      • From: David Duncan <email@hidden>
References: 
 >Leopard: CGContextDrawShading crash a known problem? (From: Pierre Bernard <email@hidden>)

  • Prev by Date: Re: Immediate sending of changes to text fields
  • Next by Date: Assignment problem with doubles: turning into NaN under Leopard
  • Previous by thread: Leopard: CGContextDrawShading crash a known problem?
  • Next by thread: Re: [Leopard] CIContext thread safety [was: CGContextDrawShading crash a known problem?]
  • Index(es):
    • Date
    • Thread