From 7e60aba04aba04547599953e45df505901fca617 Mon Sep 17 00:00:00 2001 From: "Brian J. Burg" Date: Thu, 15 Nov 2012 09:20:10 -0800 Subject: [PATCH] Fix double release caused by base::as_CFType. --- base.rs | 3 +++ 1 file changed, 3 insertions(+) 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 } }