[Mono-osx] Memory Leak ?

Miguel de Icaza miguel at novell.com
Mon Jan 10 09:55:19 EST 2011


>
> Yes the NSAutoreleasePool works in this instance.  I suggested the
> NSTimer.CreateRepeatingScheduledTimer solution because I have had problems
> with the .Net Timers updating the user interface in MonoMac.  Most recently
> with Cocoa Bindings.
>

.NET timers call your method on a *separate* thread.

As with every other toolkit in the world, you can not really access UI
objects from the UI thread safely, you can not assume that those objects are
in any state that you can touch.  The typical solution is for a timer to
"queue" a method to be invoked on the main UI thread (every major toolkit
has this feature nowadays).

In MonoMac and MonoTouch's case you use the NSObject method
"BeginInvokeOnMainThread" which will queue the method you pass to be invoked
on the UI thread when the UI thread has the ability to do so.

Miguel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20110110/8c17a941/attachment.html 


More information about the Mono-osx mailing list