• 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
Threading and GraphicContext
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Threading and GraphicContext


  • Subject: Threading and GraphicContext
  • From: Thomas Dingler <email@hidden>
  • Date: Tue, 3 Apr 2007 09:51:54 +0200

Hi,

we have a problem using NSGraphicContext/CGGraphicContext in threads. One the one (main) thread, we use the context to draw normal stuff.
There we also draw semi-transparent CIImages, so we added CGContextBeginTransparencyLayer and CGContextEndTransparencyLayer calls. Also some CGContextClipToRect calls are needed while drawing. This works normally without problems.
But than we added another thread to cache the created CIImages. This thread creates a bitmap representation using [NSGraphicsContextgraphicsContextWithBitmapImageRep:theBitMapToBeSaved]; and uses [[nsContext CIContext] drawImage:] to draw to this bitmap rep.


While doing this, everything works fine, but in not determinable circumstances the application crashs with such a stack trace:


Thread 0 Crashed:
0 <<00000000>> 0xfffeff18 objc_msgSend_rtp + 24
1 com.apple.QuartzCore 0x94298078 -[CICGContextImpl setOwner:] + 40
2 com.apple.QuartzCore 0x94316c00 -[CIContext invalidate] + 44
3 com.apple.QuartzCore 0x94316b9c -[CIContext dealloc] + 36
4 com.apple.CoreFoundation 0x907eace8 CFDictionaryRemoveValue + 492
5 com.apple.AppKit 0x937a5358 -[NSCGSContext dealloc] + 36
6 com.apple.AppKit 0x937a5320 - [NSWindowGraphicsContext dealloc] + 76
7 com.apple.AppKit 0x937a529c -[_NSViewGState dealloc] + 56
8 com.apple.Foundation 0x92939968 NSPopAutoreleasePool + 536
9 com.apple.AppKit 0x93702d34 -[NSApplication run] + 544
10 com.apple.AppKit 0x937f387c NSApplicationMain + 452



Any ideas where a error could be? I tried to retain the context while drawing and release it after drawing, but this has no effect.


Greetings,

Thomas Dingler


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Threading and GraphicContext
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: Re: NSDateFormatter weekdaySymbols
  • Next by Date: Re: NSDateFormatter weekdaySymbols
  • Previous by thread: No cocoa-heads Lake Forest meeting in April
  • Next by thread: Re: Threading and GraphicContext
  • Index(es):
    • Date
    • Thread