Fix double release caused by base::as_CFType.

This commit is contained in:
Brian J. Burg
2012-11-15 09:20:10 -08:00
parent 1f0bc6db0d
commit 7e60aba04a
+3
View File
@@ -82,6 +82,9 @@ impl<T:Copy AbstractCFTypeRef,S:AbstractCFType<T>> S : CFTypeOps<T> {
}
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 }
}