Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix accessing the UI from non main thread #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions VNCController.m
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,17 @@ - (void) dedicatedUpdateHostInfoThread {
[ipString replaceCharactersInRange:NSMakeRange(ipString.length,0) withString:@"\tInternal"];
}

if (controller && !limitToLocalConnections.state) { // Colorize and add tooltip

__block BOOL isLimitToLocalConnectionsEnabled;
__block int runningPortNum;
dispatch_sync(dispatch_get_main_queue(), ^{
isLimitToLocalConnectionsEnabled = limitToLocalConnections.state;
runningPortNum = self.runningPortNum;
});

if (controller && !isLimitToLocalConnectionsEnabled) { // Colorize and add tooltip

NSURL *testURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@:%d",
anIP, self.runningPortNum]];
anIP, runningPortNum]];
NSData *testData = [NSData dataWithContentsOfURL:testURL];
NSString *testString = (testData.length
? [NSString stringWithUTF8String: testData.bytes] : @"");
Expand Down