diff --git a/base.rs b/base.rs index e257a72..be175c5 100644 --- a/base.rs +++ b/base.rs @@ -82,6 +82,9 @@ impl> S : CFTypeOps { } static fn as_CFType(obj: S) -> CFType { + // so we don't deallocate while transferring into CFType. + // the call will be balanced by the dtor of the returned wrapper. + CFRetain(obj.get_ref().as_type_ref()); let tyref : CFTypeRef = base::unwrap(move obj).as_type_ref(); CFType { obj: tyref } }