Skip navigation.
 
mlCrash in NSImage -lockFocus
FROM : Paul Collins
DATE : Thu Sep 30 21:03:33 2004

Any suggestions as to what might cause this crash? The code below was
executed roughly 15,000 times over 15 hours before it crashed. The
NSImage is created from a web-downloaded file, although the same file
was processed before so I don't think it's caused by bad data. My app
also occassionally crashes in NSView -lockFocus but we think this is a
different issue - or is it?

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x8ea2d503

Thread 0 Crashed:
  #0  0x936f9d00 in CGSReleaseObj
  #1  0x91f516c0 in ripc_InitializeDevice
  #2  0x91f56598 in __CGWindowContextCreate
  #3  0x93731050 in CGWindowContextCreate
  #4  0x9311a52c in -[NSWindowGraphicsContext _initWithWindowNumber:]
  #5  0x93078fe0 in -[NSWindow _threadContext]
  #6  0x93084674 in -[NSWindow _windowDeviceRound]
  #7  0x930f6750 in CreateCacheWindow
  #8  0x931321cc in NewCacheWindowInfo
  #9  0x930ed600 in GetSharedSpaceFor
  #10  0x930c1954 in _NXAllocateImageCache
  #11  0x930a4588 in -[NSImage _focusOnCache:]
  #12  0x930cbee8 in -[NSImage _cacheRepresentation:stayFocused:]
  #13  0x930f4c6c in -[NSImage _lockFocusOnRep:]
  #14  0x930ccce8 in -[NSImage lockFocus]
  #15  0x0001e1a0 in -[ODSlide makeThumbnailWithImage:size:]


- (void)makeThumbnailWithImage:(NSImage *)image size:(NSSize)thumbsize {
   NSSize mySize = truSize; // Original image's size calculated from
height/width (i.e., pixels)
   if (mySize.width == 0) {
       mySize = [image size]; // if no truSize, use image size
   }
   [image setScalesWhenResized:YES];
   [image setFlipped:YES];
   [image setSize: NSMakeSize(128,128)];     // resize the image to this
particular size
   [image recache];
   NS_DURING
       [image lockFocus]; // Force image to be cached by Quartz
       [image unlockFocus];
   NS_HANDLER
       ODLog(@"Exception: NSImage -lockFocus failed for object %@", [self
canonURL]);
   NS_ENDHANDLER
}

Thanks,

Paul Collins

** Gracion Software                 http://www.gracion.com/ **
** Tel: +1 (541) 488-3488      iChat/AV/AIM: gracionsoft    **
** DigiTunnel 1.3 PPTP/VPN client for OS X                  **
** Now shipping! Envision: the new way to experience the web **

Related mailsAuthorDate
No related mails found.