• 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: NSTimer crashes after invalidation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimer crashes after invalidation


  • Subject: Re: NSTimer crashes after invalidation
  • From: Daniel Jalkut <email@hidden>
  • Date: Tue, 15 Feb 2005 14:38:46 -0800

On Feb 15, 2005, at 4:02 AM, Rosyna wrote:
And once it is retained, replace the repaintTimer!= nil with [repaintTimer isValid]

... and then release it!

Better to just take out the invalidation altogether, and don't bother retaining it. Don't even bother saving the repaintTimer variable. What's it needed for? No need to invalidate a fire-once timer, it's done for you. And no need to release it, because it was retained and released by the runloop.

Daniel

Ack, at 2/15/05, M. Uli Kusterer said:

At 1:43 Uhr +0100 15.02.2005, Michael Becker wrote:
if (repaintTimer != nil) {
// This line crashes
[repaintTimer invalidate];
}
repaintTimer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:[self documentView] selector:@selector(noLiveZoom) userInfo:nil repeats:NO];

You need to retain the timer. Fire-once timers automatically invalidate themselves once they have fired, and if you don't retain the timer, that means it'll be released, and you'll have a stale pointer lying around in your instance variable.

--



Sincerely, Rosyna Keller Technical Support/Holy Knight/Always needs a hug

Unsanity: Unsane Tools for Insanely Great People
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
sweater.com


This email sent to email@hidden

_______________________________________________ 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
  • Follow-Ups:
    • Re: NSTimer crashes after invalidation
      • From: Michael Becker <email@hidden>
References: 
 >NSTimer crashes after invalidation (From: Michael Becker <email@hidden>)
 >Re: NSTimer crashes after invalidation (From: "M. Uli Kusterer" <email@hidden>)
 >Re: NSTimer crashes after invalidation (From: Rosyna <email@hidden>)

  • Prev by Date: Re: IB question
  • Next by Date: Re: Saving NSObjectController info
  • Previous by thread: Re: NSTimer crashes after invalidation
  • Next by thread: Re: NSTimer crashes after invalidation
  • Index(es):
    • Date
    • Thread