You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
380 B
13 lines
380 B
5 years ago
|
When a block captures `weakSelf` in the following pattern:
|
||
|
|
||
|
```
|
||
|
__weak __typeof(self) weakSelf = self;
|
||
|
int (^my_block)() = ^() {
|
||
|
__strong __typeof(weakSelf) strongSelf = weakSelf;
|
||
|
int y = strongSelf->x;
|
||
|
```
|
||
|
|
||
|
the variable `strongSelf` should be checked for `null` before being used,
|
||
|
otherwise this could cause a crash because the weak pointer `weakSelf` could be
|
||
|
`null`.
|