Asignar propiedades, objetos ARC y Core Foundation.

Editar 2.

Gracias aConocer esto está funcionando ahora. E incluso creo que entiendo por qué :-)

Aquí está la línea modificada:

- (void) reCreatePath {
    CGMutablePathRef p = ::CGPathCreateMutable() ;

    ::CGPathMoveToPoint         (p, 0, TL.x, TL.y) ;
    // [snip]
    ::CGPathAddLineToPoint      (p, 0, BL.x, BL.y) ;
    ::CGPathCloseSubpath(p) ;


    self.path = p ;
    ::CGPathRelease(p) ;   // <<== THIS IS IT!! :-)
}
Editar.

Todavía no lo entiendo. Intenté la sugerencia de Chuck:

@property (nonatomic, strong) __attribute__((NSObject)) CGPathRef  path ;

Al igual que:

@interface TopLeftSlidingView  ()

@property (nonatomic, strong) __attribute__((NSObject)) CGPathRef  path ;

@end

Y en el punto donde recreo el CGPath:

- (void) reCreatePath {
    CGMutablePathRef p = ::CGPathCreateMutable() ;

    ::CGPathMoveToPoint         (p, 0, TL.x, TL.y) ;
    // [snip]
    ::CGPathAddLineToPoint      (p, 0, BL.x, BL.y) ;
    ::CGPathCloseSubpath(p) ;


//    self.path = (__bridge CGMutablePathRef) p ;
//    self.path = (__bridge_transfer CGMutablePathRef) p ;
//    self.path = (__bridge_retained CGMutablePathRef) p ;
    self.path = p ;
}

Cualquiera de las tres líneas comentadas produce un error de compilación. La línea no comentada se compila, pero genera una advertencia del analizador:

/Users/verec/Projects/WordGame/WordGame/classes/TopLeftSlidingView.mm:211:26:
 Call to function 'CGPathCreateMutable' returns a Core Foundation object with
 a +1 retain count

seguido por:

/Users/verec/Projects/WordGame/WordGame/classes/TopLeftSlidingView.mm:225:5:
 Object leaked: object allocated and stored into 'p' is not referenced later 
 in this execution path and has a retain count of +1

Simplemente no lo entiendo :(

Considerar:

@interface Test : NSObject

@property (nonatomic, assign) CGColorRef color ;

@end

@implementation Test

- (void) dealloc {
    if (self.color) {
        ::CGColorRelease(self.color) ;
        self.color = 0 ;
    }
}

- (id) init {
    if (self = [super init]) {
        self.color = ::CGColorRetain([UIColor blueColor].CGColor) ;
    }
    return self ;
}

@end

Todo esto se compila (y aparentemente se ejecuta) bien, excepto que el analizador sigue informando advertencias.

En esencia, lo que dice este código es: "Por favor, ARC, no te molestes en hacer nada concolor, por favor trátelo como trataría a cualquier otro.assign propiedad, ya sea un BOOL o CGFloat, estoy manejando la administración de la memoria por mi cuenta. "

¡Excepto que ARC se niega a escucharme y todavía se queja!

He leído muchas preguntas aquí en SO, pero ninguna de ellas parece abordar este problema ...

La clave aquí, y el compilador (aunque no el analizador) parece estar de acuerdo, es que al declarar la propiedad "asignar", he afirmado que debo manejarlo todo por mi cuenta ...

Así que debo estar equivocado, pero no veo por qué ...

Que pasa

Respuestas a la pregunta(1)

Su respuesta a la pregunta