xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #2448: connect-after-mainloop.patch

File connect-after-mainloop.patch, 2.1 KB (added by totaamwin32, 2 years ago)

better solution - work in progress

  • xpra/scripts/main.py

     
    14571457            app.start_new_commands = []
    14581458
    14591459        def connect_to_server():
    1460             conn, display_desc = connect()
    1461             app.display_desc = display_desc
    1462             #UGLY warning: connect will parse the display string,
    1463             #which may change the username and password..
    1464             app.username = opts.username
    1465             app.password = opts.password
    1466             app.display = opts.display
    1467             app.setup_connection(conn)
    1468             return conn
     1460            #on win32, we must run the main loop
     1461            #before we can call connect()
     1462            #because connect() may run a subprocess,
     1463            #and Gdk locks up the system if the main loop is not running by then!
     1464            def do_setup_connection():
     1465                conn, display_desc = connect()
     1466                #UGLY warning: connect will parse the display string,
     1467                #which may change the username and password..
     1468                app.username = opts.username
     1469                app.password = opts.password
     1470                app.display = opts.display
     1471                app.display_desc = display_desc
     1472                app.setup_connection(conn)
     1473            def setup_connection():
     1474                from xpra.make_thread import start_thread
     1475                start_thread(do_setup_connection, "setup-connection", True)
     1476            from gi.repository import GLib
     1477            GLib.idle_add(setup_connection)
    14691478
    14701479        try:
    14711480            if mode=="listen":
     
    15101519                                run_socket_cleanups()
    15111520                                netlog.info("connecting to %s", uri)
    15121521                                extra_args[:] = [uri, ]
    1513                                 conn = connect_to_server()
     1522                                connect_to_server()
    15141523                                app._protocol.start()
    15151524                                app.idle_add(app.send_hello)
    15161525                                return