This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository libx2goclient. commit fc378873b96bb9673b4460dc85e14aa956c38534 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Sep 17 11:39:39 2020 +0200 src/x2goclient-network-ssh.c: pass self instead of the main context to check thread main function. We'll eventually need this later on. Doing that sadly also means that we have to protect it through the mutex, including locking and unlocking calls in the check thread's main function. --- src/x2goclient-network-ssh.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/x2goclient-network-ssh.c b/src/x2goclient-network-ssh.c index 1ddc299..daa0605 100644 --- a/src/x2goclient-network-ssh.c +++ b/src/x2goclient-network-ssh.c @@ -1444,21 +1444,31 @@ static void x2goclient_network_ssh_check_timeout_data_free (struct x2goclient_ne static gpointer x2goclient_network_ssh_check_timeout_thread_main (const gpointer user_data) { gpointer ret = NULL; - GMainContext *main_context = user_data; GMainLoop *main_loop; + X2GoClientNetworkSSH *self = user_data; + g_return_val_if_fail (X2GOCLIENT_IS_NETWORK_SSH (self), ret); + + g_mutex_lock (&(self->check_thread_mutex)); /* Make given main context the default one for this thread. */ - g_main_context_push_thread_default (main_context); + g_main_context_push_thread_default (self->check_thread_context); + g_mutex_unlock (&(self->check_thread_mutex)); /* Add new main loop and execute it. */ main_loop = g_main_loop_new (main_context, FALSE); g_main_loop_run (main_loop); + g_mutex_lock (&(self->check_thread_mutex)); /* Clean up everything after g_main_loop_run () returned. */ g_main_loop_unref (main_loop); - g_main_context_pop_thread_default (main_context); - g_main_context_unref (main_context); + /* Unmap context. */ + g_main_context_pop_thread_default (self->check_thread_context); + + /* Destroy context. */ + g_main_context_unref (self->check_thread_context); + self->check_thread_context = NULL; + g_mutex_unlock (&(self->check_thread_mutex)); return (ret); } @@ -1471,8 +1481,10 @@ static gboolean x2goclient_network_ssh_start_check_timeout (X2GoClientNetworkSSH g_mutex_lock (&(self->check_thread_mutex)); self->check_thread_context = g_main_context_new (); + + /* Create and start thread. */ + self->check_thread = g_thread_new ("check_thread", &x2goclient_network_ssh_check_timeout_thread_main, self); g_mutex_unlock (&(self->check_thread_mutex)); - self->check_thread = g_thread_new ("check_thread", &x2goclient_network_ssh_check_timeout_thread_main, g_main_context_ref (self->check_thread_context)); x2goclient_network_ssh_start_check_timeout_invoke (self, gerr); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/libx2goclient.git