[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with NSViewAnimation and NSTimer

From: Fred Kiefer
Subject: Problems with NSViewAnimation and NSTimer
Date: Sun, 24 Jul 2011 21:02:05 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv: Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11

I just switched the implementation of NSWindow setFrame:display:animate: over to using an NSViewAnimation. The reason for this was that the old blocking code could yield wrong results as intermediate setFrame: events send from the backend would not be processed during the animation and at the end the window could end up in a messed state.

With NSViewAnimation I first had the problem that this code was not prepared to ever release an NSViewAnimation, this was easy to fix, still I needed a helper object that will release the animation when it ends. I was hoping that I could release the animation after starting it and then rely on it to free itself up when it gets stopped. But this wont work with our current code in NSAnimation and with all the lock handling scattered in there I did not dare to change anything. With my helper object things basically work, although I am not sure that in a garbage collected environment the same will be true.

Not there is one remaining problem. When I start the animation it registers an NSTimer itself for the run modes NSDefaultRunLoopMode, NSModalPanelRunLoopMode and NSEventTrackingRunLoopMode. When the animation gets stopped the timer gets invalidated and will be removed from the corresponding run loops later on. But as there is no NSModalPanelRunLoopMode going on in my test application it never gets removed from that list and I end up with all these timers living forever. Not that I care much, even a few hundred timers shouldn't stop that application from working, still it looks wrong to me.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]