[connections] rdp-connection: Wait for RDP connection



commit 2dd6179cc3dce26c76cdb072c394352f88cd0af8
Author: Marek Kasik <mkasik redhat com>
Date:   Wed Aug 3 12:32:16 2022 +0200

    rdp-connection: Wait for RDP connection
    
    Set connected to "true" when connected instead of right after request to
    connect. This fixes a crash which happenned due to accessing properties
    of FrdpSession which was not initialised yet.
    
    Fixes #114

 src/rdp-connection.vala | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/rdp-connection.vala b/src/rdp-connection.vala
index 84213e8..b02841a 100644
--- a/src/rdp-connection.vala
+++ b/src/rdp-connection.vala
@@ -71,7 +71,7 @@ namespace Connections {
             display.bind_property ("password", this, "password", BindingFlags.BIDIRECTIONAL);
 
             display.rdp_error.connect (on_rdp_connection_error_cb);
-            display.rdp_connected.connect (() => { show (); });
+            display.rdp_connected.connect (on_rdp_connection_connected_cb);
             //display.rdp_needs_authentication.connect (on_rdp_auth_credential_cb);
             display.rdp_auth_failure.connect (auth_failed);
             //display.size_allocate.connect (scale);
@@ -108,10 +108,6 @@ namespace Connections {
             }
 
             display.open_host (host, port);
-            connected = true;
-            scaling = true;
-
-            display.grab_focus ();
         }
 
         public override void disconnect_it () {
@@ -140,6 +136,14 @@ namespace Connections {
 
             on_connection_error_cb (reason);
         }
+
+        private void on_rdp_connection_connected_cb () {
+            connected = true;
+            scaling = true;
+
+            display.grab_focus ();
+            show ();
+        }
     }
 
     private class FrdpDisplay : Frdp.Display {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]