diff --git a/include/wx/osx/core/cfref.h b/include/wx/osx/core/cfref.h index 1885307e88..ab2a8b4d8a 100644 --- a/include/wx/osx/core/cfref.h +++ b/include/wx/osx/core/cfref.h @@ -68,8 +68,8 @@ template inline Type* wxCFAutorelease(Type *r) { if ( r != NULL ) - return (Type*)::CFAutorelease((CFTypeRef)r); - return NULL; + r = const_cast(static_cast(::CFAutorelease(static_cast(r)))); + return r; } /*! @function wxCFRetain