diff --git a/contrib/mobile/iOS/Onelab/ModelViewController.mm b/contrib/mobile/iOS/Onelab/ModelViewController.mm index 3f45ed9d6e411af4cbd43371fbed70394ebfd9d1..30e4c7d21622de88c23f3550c3609f8f4acd0e91 100644 --- a/contrib/mobile/iOS/Onelab/ModelViewController.mm +++ b/contrib/mobile/iOS/Onelab/ModelViewController.mm @@ -182,17 +182,21 @@ dispatch_group_notify(group, queue, ^{ [UIApplication sharedApplication].applicationIconBadgeNumber = -1; - [_runStopButton setAction:@selector(compute)]; - [_runStopButton setTitle:@"Run"]; - [_progressLabel setHidden:YES]; - [_progressIndicator stopAnimating]; - [_progressIndicator setHidden:YES]; - if(_errors.count > 0) { - _errorAlert = [[UIErrorAlertView alloc] initWithTitle:@"Gmsh/GetDP error" message:[_errors lastObject] delegate:self cancelButtonTitle:@"Hide" otherButtonTitles:@"Show more", nil]; - [_errorAlert show]; - } + [self performSelectorOnMainThread:@selector(stopGUI) withObject:nil waitUntilDone:YES]; }); } +-(void)stopGUI +{ + [_runStopButton setAction:@selector(compute)]; + [_runStopButton setTitle:@"Run"]; + [_progressLabel setHidden:YES]; + [_progressIndicator stopAnimating]; + [_progressIndicator setHidden:YES]; + if(_errors.count > 0) { + _errorAlert = [[UIErrorAlertView alloc] initWithTitle:@"Gmsh/GetDP error" message:[_errors lastObject] delegate:self cancelButtonTitle:@"Hide" otherButtonTitles:@"Show more", nil]; + [_errorAlert show]; + } +} - (void)stop { onelab_cb("stop");