• 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
Re: setNeedsDisplay broken in Tiger
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setNeedsDisplay broken in Tiger


  • Subject: Re: setNeedsDisplay broken in Tiger
  • From: Bob Ippolito <email@hidden>
  • Date: Tue, 24 May 2005 10:00:15 -0700


On May 24, 2005, at 9:31 AM, John Nairn wrote:

I have a thread that wants to tell a view to update and then the thread must wait until the view is updated before continuing. This thread worked fine until Tiger. The code fragment is

[myView setNeedsDisplay:YES]
NSLog(@"needsDisplay is now %d",(int)[myView needsDisplay]); // it shows "1"
[myView displayIfNeeded]; // force update (but was not needed before Tiger)
while(YES)
{ [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow: 0.2]];
if([myView needsDisplay]==NO) break;
}


But the loop that waits until the view is updated never exits. I checked and drawRect is being called and successfully finished, but needsDisplay is never set back to NO. This was all fine until compiling in Tiger. What has changed in Tiger about updating views in a thread? Or is there another way to have a thread wait until a view has completed an update?

This shouldn't have ever worked. These messages are not thread-safe, and must be sent on the main thread. In general, Cocoa isn't thread- safe except in places where the documentation explicitly says it is, and those NSView messages are not exceptions.


As currently documented, ONLY the following NSView messages are thread-safe:

-beginDocument
-lockFocusIfCanDraw
-lockFocusIfCanDrawInContext:

-bob

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >setNeedsDisplay broken in Tiger (From: John Nairn <email@hidden>)

  • Prev by Date: Re: FYI: User feedback for LSMinimumSystemVersion
  • Next by Date: Re: International date formatting
  • Previous by thread: setNeedsDisplay broken in Tiger
  • Next by thread: Re: setNeedsDisplay broken in Tiger
  • Index(es):
    • Date
    • Thread