Don't send retain / release messages in GC mode when copying object pointers into blocks.

main
theraven 15 years ago
parent d1199844cb
commit e7767baf50

@ -363,11 +363,15 @@ void _Block_object_assign(void *destAddr, const void *object, const int flags)
{ {
fprintf(stderr, "-retain\n"); fprintf(stderr, "-retain\n");
id src = (id)object; id src = (id)object;
id *dst = destAddr; void **dst = destAddr;
*dst = src;
if (!isGCEnabled)
{
*dst = [src retain]; *dst = [src retain];
} }
} }
} }
}
/* Similarly a compiler generated dispose helper needs to call back for each /* Similarly a compiler generated dispose helper needs to call back for each
* field of the byref data structure. (Currently the implementation only packs * field of the byref data structure. (Currently the implementation only packs
@ -436,10 +440,13 @@ void _Block_object_dispose(const void *object, const int flags)
else if((flags & BLOCK_FIELD_IS_OBJECT) == BLOCK_FIELD_IS_OBJECT) else if((flags & BLOCK_FIELD_IS_OBJECT) == BLOCK_FIELD_IS_OBJECT)
{ {
id src = (id)object; id src = (id)object;
if (!isGCEnabled)
{
[src release]; [src release];
} }
} }
} }
}
// Copy a block to the heap if it's still on the stack or increments its retain count. // Copy a block to the heap if it's still on the stack or increments its retain count.

Loading…
Cancel
Save