FROM : Adam R. Maxwell
DATE : Sun Mar 30 17:01:16 2008
On Mar 30, 2008, at 6:10 AM, Thomas Engelmeier wrote:
>
> On 29.03.2008, at 18:54, Adam R. Maxwell wrote:
>>
>> Drawing into an NSImage is explicitly documented to be thread safe
>> in the article you linked to, and each thread has its own graphics
>> context. The post I linked to does indicate that you might want to
>> use [image setCacheMode:NSImageCacheNever]. If your goal is just
>> to get an NSBitmapImageRep from a file, it's probably easier just
>> to use +imageRepWithContentsOfFile:.
>
> While it is documented to be thread save you might get crashes later
> when an NSBitmapImageRep created by drawing into from an secondary
> thread gets drawn itself. The crash occurs when the image tries to
> access an NULL (offscreen) window context (it probably was
> originally drawn into).
>
> Tried to debug that on 10.5.2 (and simply worked around)...
That's interesting. Was it an NSBitmapImageRep or NSImage/
NSCachedImageRep? I didn't think a bitmap context would be associated
with a window context like that. Either way it doesn't sound good,
though.
--
adam
On Mar 30, 2008, at 6:10 AM, Thomas Engelmeier wrote:
>
> On 29.03.2008, at 18:54, Adam R. Maxwell wrote:
>>
>> Drawing into an NSImage is explicitly documented to be thread safe
>> in the article you linked to, and each thread has its own graphics
>> context. The post I linked to does indicate that you might want to
>> use [image setCacheMode:NSImageCacheNever]. If your goal is just
>> to get an NSBitmapImageRep from a file, it's probably easier just
>> to use +imageRepWithContentsOfFile:.
>
> While it is documented to be thread save you might get crashes later
> when an NSBitmapImageRep created by drawing into from an secondary
> thread gets drawn itself. The crash occurs when the image tries to
> access an NULL (offscreen) window context (it probably was
> originally drawn into).
>
> Tried to debug that on 10.5.2 (and simply worked around)...
That's interesting. Was it an NSBitmapImageRep or NSImage/
NSCachedImageRep? I didn't think a bitmap context would be associated
with a window context like that. Either way it doesn't sound good,
though.
--
adam
DATE : Sun Mar 30 17:01:16 2008
On Mar 30, 2008, at 6:10 AM, Thomas Engelmeier wrote:
>
> On 29.03.2008, at 18:54, Adam R. Maxwell wrote:
>>
>> Drawing into an NSImage is explicitly documented to be thread safe
>> in the article you linked to, and each thread has its own graphics
>> context. The post I linked to does indicate that you might want to
>> use [image setCacheMode:NSImageCacheNever]. If your goal is just
>> to get an NSBitmapImageRep from a file, it's probably easier just
>> to use +imageRepWithContentsOfFile:.
>
> While it is documented to be thread save you might get crashes later
> when an NSBitmapImageRep created by drawing into from an secondary
> thread gets drawn itself. The crash occurs when the image tries to
> access an NULL (offscreen) window context (it probably was
> originally drawn into).
>
> Tried to debug that on 10.5.2 (and simply worked around)...
That's interesting. Was it an NSBitmapImageRep or NSImage/
NSCachedImageRep? I didn't think a bitmap context would be associated
with a window context like that. Either way it doesn't sound good,
though.
--
adam
On Mar 30, 2008, at 6:10 AM, Thomas Engelmeier wrote:
>
> On 29.03.2008, at 18:54, Adam R. Maxwell wrote:
>>
>> Drawing into an NSImage is explicitly documented to be thread safe
>> in the article you linked to, and each thread has its own graphics
>> context. The post I linked to does indicate that you might want to
>> use [image setCacheMode:NSImageCacheNever]. If your goal is just
>> to get an NSBitmapImageRep from a file, it's probably easier just
>> to use +imageRepWithContentsOfFile:.
>
> While it is documented to be thread save you might get crashes later
> when an NSBitmapImageRep created by drawing into from an secondary
> thread gets drawn itself. The crash occurs when the image tries to
> access an NULL (offscreen) window context (it probably was
> originally drawn into).
>
> Tried to debug that on 10.5.2 (and simply worked around)...
That's interesting. Was it an NSBitmapImageRep or NSImage/
NSCachedImageRep? I didn't think a bitmap context would be associated
with a window context like that. Either way it doesn't sound good,
though.
--
adam
| Related mails | Author | Date |
|---|---|---|
| Trygve Inda | Mar 29, 14:44 | |
| Jens Alfke | Mar 29, 18:05 | |
| Adam R. Maxwell | Mar 29, 18:54 | |
| Trygve Inda | Mar 29, 20:20 | |
| Adam R. Maxwell | Mar 29, 20:48 | |
| Thomas Engelmeier | Mar 30, 15:10 | |
| Adam R. Maxwell | Mar 30, 17:01 | |
| Trygve Inda | Mar 30, 17:34 | |
| Jens Alfke | Mar 30, 19:02 | |
| glenn andreas | Mar 30, 19:14 | |
| Trygve Inda | Mar 30, 22:21 | |
| glenn andreas | Mar 30, 22:35 | |
| Thomas Engelmeier | Mar 31, 12:30 |






Cocoa mail archive

