[Xfce4-commits] [apps/xfce4-screensaver] 153/425: Don't use deprecated GLib threading API.

noreply at xfce.org noreply at xfce.org
Mon Oct 15 01:50:00 CEST 2018


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-screensaver.

commit ae84d24ec2557014212487164c1b4fce615a8203
Author: infirit <infirit at gmail.com>
Date:   Wed Jul 2 18:55:45 2014 +0200

    Don't use deprecated GLib threading API.
---
 savers/gste-slideshow.c | 12 +-----------
 src/gs-auth-pam.c       | 40 ++++++++++++++--------------------------
 2 files changed, 15 insertions(+), 37 deletions(-)

diff --git a/savers/gste-slideshow.c b/savers/gste-slideshow.c
index 61d6a19..4bc5dbb 100644
--- a/savers/gste-slideshow.c
+++ b/savers/gste-slideshow.c
@@ -1062,8 +1062,6 @@ set_colormap (GtkWidget *widget)
 static void
 gste_slideshow_init (GSTESlideshow *show)
 {
-	GError *error;
-
 	show->priv = GSTE_SLIDESHOW_GET_PRIVATE (show);
 
 	show->priv->images_location = g_strdup (DEFAULT_IMAGES_LOCATION);
@@ -1071,15 +1069,7 @@ gste_slideshow_init (GSTESlideshow *show)
 	show->priv->op_q = g_async_queue_new ();
 	show->priv->results_q = g_async_queue_new ();
 
-	error = NULL;
-	show->priv->load_thread = g_thread_create ((GThreadFunc)load_threadfunc, show->priv->op_q, FALSE, &error);
-	if (show->priv->load_thread == NULL)
-	{
-		g_error ("Could not create a thread to load images: %s",
-		         error->message);
-		g_error_free (error);
-		exit (-1);
-	}
+	g_thread_new ("loadthread", (GThreadFunc)load_threadfunc, show->priv->op_q);
 
 #if GTK_CHECK_VERSION (3, 0, 0)
 	set_visual (GTK_WIDGET (show));
diff --git a/src/gs-auth-pam.c b/src/gs-auth-pam.c
index f5c761e..f150277 100644
--- a/src/gs-auth-pam.c
+++ b/src/gs-auth-pam.c
@@ -98,8 +98,8 @@ typedef struct
 	gboolean           should_interrupt_stack;
 } GsAuthMessageHandlerData;
 
-static GCond  *message_handled_condition;
-static GMutex *message_handler_mutex;
+static GCond  message_handled_condition;
+static GMutex message_handler_mutex;
 
 GQuark
 gs_auth_error_quark (void)
@@ -194,7 +194,7 @@ gs_auth_queued_message_handler (GsAuthMessageHandlerData *data)
 		g_message ("Waiting for lock");
 	}
 
-	g_mutex_lock (message_handler_mutex);
+	g_mutex_lock (&message_handler_mutex);
 
 	if (gs_auth_get_verbose ())
 	{
@@ -208,8 +208,8 @@ gs_auth_queued_message_handler (GsAuthMessageHandlerData *data)
 
 	data->should_interrupt_stack = res == FALSE;
 
-	g_cond_signal (message_handled_condition);
-	g_mutex_unlock (message_handler_mutex);
+	g_cond_signal (&message_handled_condition);
+	g_mutex_unlock (&message_handler_mutex);
 
 	if (gs_auth_get_verbose ())
 	{
@@ -233,7 +233,7 @@ gs_auth_run_message_handler (struct pam_closure *c,
 	data.resp = resp;
 	data.should_interrupt_stack = TRUE;
 
-	g_mutex_lock (message_handler_mutex);
+	g_mutex_lock (&message_handler_mutex);
 
 	/* Queue the callback in the gui (the main) thread
 	 */
@@ -246,9 +246,9 @@ gs_auth_run_message_handler (struct pam_closure *c,
 
 	/* Wait for the response
 	 */
-	g_cond_wait (message_handled_condition,
-	             message_handler_mutex);
-	g_mutex_unlock (message_handler_mutex);
+	g_cond_wait (&message_handled_condition,
+	             &message_handler_mutex);
+	g_mutex_unlock (&message_handler_mutex);
 
 	if (gs_auth_get_verbose ())
 	{
@@ -380,18 +380,6 @@ close_pam_handle (int status)
 		}
 	}
 
-	if (message_handled_condition != NULL)
-	{
-		g_cond_free (message_handled_condition);
-		message_handled_condition = NULL;
-	}
-
-	if (message_handler_mutex != NULL)
-	{
-		g_mutex_free (message_handler_mutex);
-		message_handler_mutex = NULL;
-	}
-
 	return TRUE;
 }
 
@@ -464,8 +452,8 @@ create_pam_handle (const char      *username,
 	}
 
 	ret = TRUE;
-	message_handled_condition = g_cond_new ();
-	message_handler_mutex = g_mutex_new ();
+	g_cond_init (&message_handled_condition);
+	g_mutex_init (&message_handler_mutex);
 
 out:
 	if (status_code != NULL)
@@ -675,9 +663,9 @@ gs_auth_pam_verify_user (pam_handle_t *handle,
 	watch_id = g_io_add_watch (channel, G_IO_ERR | G_IO_HUP,
 	                           (GIOFunc) gs_auth_loop_quit, &thread_done);
 
-	auth_thread = g_thread_create ((GThreadFunc) gs_auth_thread_func,
-	                               GINT_TO_POINTER (auth_operation_fds[1]),
-	                               TRUE, NULL);
+	auth_thread = g_thread_new ("auththread",
+                                    (GThreadFunc) gs_auth_thread_func,
+                                    GINT_TO_POINTER (auth_operation_fds[1]));
 
 	if (auth_thread == NULL)
 	{

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list