سؤال

I have a Cocoa class bound in monomac. If I call Dispose() on an instance of that class, should it always invoke dealloc on the unmanaged side?

What reasons might there be for dealloc not being invoked when the managed class is Dispose()ed?

هل كانت مفيدة؟

المحلول

Dispose on the managed object will call release on the native object, not dealloc (but it may end up deallocating the object if nobody else has retained it).

Note that calling Dispose multiple times will only call release once.

Update

This turned out to be a bug in MonoMac / Xamarin.Mac (which has now been fixed).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top