Runs Mac password dialog on main UI thread

This commit is contained in:
Robert Corrigan 2016-10-08 01:39:07 -04:00
parent 267dea928c
commit ecf9eed809
3 changed files with 8 additions and 3 deletions

View File

@ -977,9 +977,11 @@ BOOL mac_authenticate(freerdp* instance, char** username, char** password,
dialog.password = [NSString stringWithCString:*password encoding: dialog.password = [NSString stringWithCString:*password encoding:
NSUTF8StringEncoding]; NSUTF8StringEncoding];
BOOL ok = [dialog runModal]; [dialog performSelectorOnMainThread:@selector(runModal) withObject:nil waitUntilDone:TRUE];
if (ok) BOOL ok = dialog.modalCode;
if (ok)
{ {
const char* submittedUsername = [dialog.username cStringUsingEncoding: const char* submittedUsername = [dialog.username cStringUsingEncoding:
NSUTF8StringEncoding]; NSUTF8StringEncoding];

View File

@ -28,6 +28,7 @@
NSString* serverHostname; NSString* serverHostname;
NSString* username; NSString* username;
NSString* password; NSString* password;
BOOL modalCode;
} }
@property (retain) IBOutlet NSTextField* usernameText; @property (retain) IBOutlet NSTextField* usernameText;
@property (retain) IBOutlet NSTextField* passwordText; @property (retain) IBOutlet NSTextField* passwordText;
@ -39,6 +40,7 @@
@property (retain) NSString* serverHostname; @property (retain) NSString* serverHostname;
@property (retain) NSString* username; @property (retain) NSString* username;
@property (retain) NSString* password; @property (retain) NSString* password;
@property BOOL modalCode;
- (BOOL) runModal; - (BOOL) runModal;

View File

@ -31,6 +31,7 @@
@synthesize serverHostname; @synthesize serverHostname;
@synthesize username; @synthesize username;
@synthesize password; @synthesize password;
@synthesize modalCode;
- (id)init - (id)init
{ {
@ -66,7 +67,7 @@
- (BOOL)runModal - (BOOL)runModal
{ {
return [NSApp runModalForWindow:self.window]; return (self.modalCode = [NSApp runModalForWindow:self.window]);
} }
- (void)dealloc - (void)dealloc