Skip to content

Commit 8bd7944

Browse files
Fix crash affecting iOS 8 & 9
1 parent 87081b6 commit 8bd7944

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ChatSecure/Classes/View Controllers/OTRMessagesViewController.m

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,9 @@ - (void)viewWillAppear:(BOOL)animated
208208
[self.lastSeenRefreshTimer invalidate];
209209
_lastSeenRefreshTimer = nil;
210210
}
211-
__weak typeof(self)weakSelf = self;
212-
_lastSeenRefreshTimer = [NSTimer scheduledTimerWithTimeInterval:5 repeats:YES block:^(NSTimer * _Nonnull timer) {
213-
__typeof__(self) strongSelf = weakSelf;
214-
if (!strongSelf) { return; }
215-
[strongSelf refreshTitleView:[strongSelf titleView]];
216-
}];
211+
_lastSeenRefreshTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(refreshTitleTimerUpdate:) userInfo:nil repeats:YES];
217212

213+
__weak typeof(self)weakSelf = self;
218214
void (^refreshGeneratingLock)(OTRAccount *) = ^void(OTRAccount * account) {
219215
__strong typeof(weakSelf)strongSelf = weakSelf;
220216
__block NSString *accountKey = nil;
@@ -485,6 +481,11 @@ - (OTRTitleSubtitleView * __nonnull)titleView {
485481
}
486482
return [[OTRTitleSubtitleView alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
487483
}
484+
485+
- (void)refreshTitleTimerUpdate:(NSTimer*)timer {
486+
[self refreshTitleView:[self titleView]];
487+
}
488+
488489
/** Updates the title view with the current thread information on this view controller*/
489490
- (void)refreshTitleView:(OTRTitleSubtitleView *)titleView
490491
{

0 commit comments

Comments
 (0)