Skip to content

Commit 75aab6d

Browse files
VLCCloudStorageTableViewController: Fix updating loop and thread issue
The CloudStorageTableViewController does not create a loop trying to update the content of the view when there are no items to be displayed anymore. The adding and removing views calls are now dispatched to the main queue to avoid crashes.
1 parent 8cdc3e1 commit 75aab6d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/VLCCloudStorageTableViewController.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ - (void)updateToolbarWithStyle:(VLCToolbarStyle)style {
203203
[items addObjectsFromArray:@[_numberOfFilesBarButtonItem, [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]]];
204204
break;
205205
}
206-
[self setToolbarItems:items animated:YES];
206+
dispatch_async(dispatch_get_main_queue(), ^{
207+
[self setToolbarItems:items animated:YES];
208+
});
207209
}
208210

209211
- (void)updateRemainingTime:(NSString *)time
@@ -269,7 +271,9 @@ - (void)updateViewAfterSessionChange
269271
}
270272
if (_authorizationInProgress || [self.controller isAuthorized]) {
271273
if (self.loginToCloudStorageView.superview) {
272-
[self.loginToCloudStorageView removeFromSuperview];
274+
dispatch_async(dispatch_get_main_queue(), ^{
275+
[self.loginToCloudStorageView removeFromSuperview];
276+
});
273277
}
274278
}
275279
if (![self.controller isAuthorized]) {
@@ -292,10 +296,6 @@ - (void)updateViewAfterSessionChange
292296
if (self.currentPath == nil) {
293297
self.currentPath = @"";
294298
}
295-
296-
if ([self.controller.currentListFiles count] == 0) {
297-
[self requestInformationForCurrentPath];
298-
}
299299
}
300300

301301
- (void)logout

0 commit comments

Comments
 (0)