Overview
Comment: | Fix reference counting for blocks.
Hopefully, there is no weird situation left where it fails... |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | 0.5 |
Files: | files | file ages | folders |
SHA3-256: |
7caa6221243c7300b1615c0b5e2f27f9 |
User & Date: | js on 2011-07-18 03:01:36 |
Other Links: | branch diff | manifest | tags |
Context
2011-07-18
| ||
23:47 | Fix a bug (hopefully the last!) in blocks. check-in: 86169923d6 user: js tags: 0.5 | |
03:01 | Fix reference counting for blocks. check-in: 7caa622124 user: js tags: 0.5 | |
2011-07-17
| ||
16:25 | Update PLATFORMS. check-in: fcc184b84d user: js tags: 0.5 | |
Changes
Modified src/OFBlock.m from [b9b5eda4af] to [52c8c831cc].
︙ | ︙ | |||
264 265 266 267 268 269 270 | } if (src->forwarding == src) src->forwarding = *dst; memcpy(*dst, src, src->size); | < < < | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | } if (src->forwarding == src) src->forwarding = *dst; memcpy(*dst, src, src->size); if (src->size >= sizeof(of_block_byref_t)) src->byref_keep(*dst, src); } else *dst = src; (*dst)->flags++; break; |
︙ | ︙ | |||
437 438 439 440 441 442 443 444 445 446 447 448 449 450 | OF_BLOCK_REFCOUNT_MASK; return OF_RETAIN_COUNT_MAX; } - (void)release { Block_release(self); } - (void)dealloc { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; | > | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | OF_BLOCK_REFCOUNT_MASK; return OF_RETAIN_COUNT_MAX; } - (void)release { if (isa == (Class)&_NSConcreteMallocBlock) Block_release(self); } - (void)dealloc { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; |
︙ | ︙ |
Modified tests/OFBlockTests.m from [10c79b74fc] to [0518f13692].
︙ | ︙ | |||
64 65 66 67 68 69 70 | (m = [[s copy] autorelease]) && [m class] == objc_getClass("OFMallocBlock") && [m isKindOfClass: [OFBlock class]]) TEST(@"Copying a global block", (id)g == [[g copy] autorelease]) TEST(@"Copying a malloc block", | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | (m = [[s copy] autorelease]) && [m class] == objc_getClass("OFMallocBlock") && [m isKindOfClass: [OFBlock class]]) TEST(@"Copying a global block", (id)g == [[g copy] autorelease]) TEST(@"Copying a malloc block", (id)m == [m copy] && [m retainCount] == 2) TEST(@"Autorelease a stack block", R([s autorelease])) TEST(@"Autorelease a global block", R([g autorelease])) TEST(@"Autorelease a malloc block", R([m autorelease])) [pool drain]; } @end |