• 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
screen dump crash with out sleep
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

screen dump crash with out sleep


  • Subject: screen dump crash with out sleep
  • From: email@hidden
  • Date: Thu, 21 Jun 2007 22:49:27 +0200

Hi

I am programming a screen dump. Please see my code. If the sleep is removed, then the application crashes.
The image is in another method directly written to file. So far it seems to be the sleep that makes it crash or not crash.


Please could somebody explain why?

Please suggestions for better/faster code is much appreciated. However please not deprecated carbon, or to low level openGL

Thank you very much

NSWindow *window;
NSBitmapImageRep *rep;
NSImage *image;

window = [[NSWindow alloc] initWithContentRect:rect styleMask:NSTitledWindowMask
backing:NSBackingStoreNonretained defer:NO];

[window setBackgroundColor:[NSColor blueColor]];
[window setLevel:NSScreenSaverWindowLevel + 1];
[window setHasShadow:NO];
[window setAlphaValue:0.0];
[window orderFront:self];
[window setContentView:[[[NSView alloc] initWithFrame:rect] autorelease]];


	sleep(1);

[[window contentView] lockFocus];
NSRect bRect = [[window contentView] bounds];
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:bRect];
[[window contentView] unlockFocus];
[window orderOut:self];
[window close];

image = [[[NSImage alloc] initWithSize:[rep size]] autorelease];
[image addRepresentation:rep];

return image;

_______________________________________________

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: screen dump crash with out sleep
      • From: Dorian Johnson <email@hidden>
  • Prev by Date: Re: __CGPixelAccessLockWindowAccess???
  • Next by Date: Re: Protocol Handling?
  • Previous by thread: Re: Distributed Objects or NSFileHandle?
  • Next by thread: Re: screen dump crash with out sleep
  • Index(es):
    • Date
    • Thread