Fixed mac app termination and warnings
authorArmin Novak <armin.novak@thincast.com>
Tue, 20 Oct 2020 07:08:37 +0000 (09:08 +0200)
committerakallabeth <akallabeth@posteo.net>
Wed, 2 Dec 2020 13:09:54 +0000 (14:09 +0100)
(cherry picked from commit a2e9f5efcb54a409ca67b2794ab20c391d732fe6)

client/Mac/MRDPView.m
client/Mac/cli/AppDelegate.m
client/Mac/cli/main.m
client/Mac/main.m
client/Mac/mf_client.m

index dc07cdc..70f67e1 100644 (file)
@@ -864,8 +864,7 @@ BOOL mac_pre_connect(freerdp *instance)
        if (!settings->ServerHostname)
        {
                WLog_ERR(TAG, "error: server hostname was not specified with /v:<server>[:port]");
-               [NSApp terminate:nil];
-               return -1;
+               return FALSE;
        }
 
        settings->OsMajorType = OSMAJORTYPE_MACINTOSH;
index d916e71..6986956 100644 (file)
@@ -73,6 +73,10 @@ void mac_set_view_size(rdpContext *context, MRDPView *view);
 
                [window setTitle:winTitle];
        }
+       else
+       {
+               [NSApp terminate:self];
+       }
 }
 
 - (void)applicationWillBecomeActive:(NSNotification *)notification
@@ -92,6 +96,7 @@ void mac_set_view_size(rdpContext *context, MRDPView *view);
        [mrdpView releaseResources];
        _singleDelegate = nil;
        NSLog(@"Stopped.\n");
+       [NSApp terminate:self];
 }
 
 - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
index 69643ef..7e5e478 100644 (file)
@@ -8,7 +8,7 @@
 
 #import <Cocoa/Cocoa.h>
 
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
 {
        return NSApplicationMain(argc, argv);
 }
index 4cba6cf..0f1916e 100644 (file)
@@ -19,7 +19,7 @@
 
 #import <Cocoa/Cocoa.h>
 
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
 {
-       return NSApplicationMain(argc, (const char **)argv);
+       return NSApplicationMain(argc, argv);
 }
index 10fb1b4..a46d3d1 100644 (file)
@@ -62,6 +62,7 @@ static int mfreerdp_client_stop(rdpContext *context)
 {
        mfContext *mfc = (mfContext *)context;
 
+       freerdp_abort_connect(context->instance);
        if (mfc->thread)
        {
                SetEvent(mfc->stopEvent);
@@ -97,7 +98,6 @@ static BOOL mfreerdp_client_new(freerdp *instance, rdpContext *context)
        context->instance->LogonErrorInfo = mac_logon_error_info;
        context->instance->settings = instance->settings;
        settings = context->settings;
-       settings->AsyncUpdate = TRUE;
        settings->AsyncInput = TRUE;
        return TRUE;
 }