Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > a32f5c216e937856712888991e707749 > files > 1

grig-0.8.0-9.mga5.src.rpm

Description: Don't call deprecated glib functions
 g_thread_init and g_thread_create are deprecated since glib 2.32.
Author: Sebastian Ramacher <sramacher@debian.org>
Last-Update: 2013-05-21

--- a/src/main.c
+++ b/src/main.c
@@ -178,13 +178,14 @@
 	g_free (fname);
 
 
+#if !GLIB_CHECK_VERSION(2,32,0)
 	/* initialize threads; according to glib docs, this call will terminate
 	   the program if threads are not supported... then why doesn''t it work
 	   on FreeBSD?
 	*/
 	if (!g_thread_supported ())
 		g_thread_init (NULL);
-
+#endif
 
 
 	/* decode command line arguments; this part of the code only sets the
--- a/src/rig-daemon.c
+++ b/src/rig-daemon.c
@@ -472,6 +472,9 @@
 	gchar **confvec;   
 	gchar **confent;
 	GError *err = NULL;  /* used when starting daemon thread */
+#if GLIB_CHECK_VERSION(2,32,0)
+  GThread* thread = NULL;
+#endif
 
 
 	grig_debug_local (RIG_DEBUG_TRACE,
@@ -636,8 +639,14 @@
 
 	}
 	else {
-
+#if !GLIB_CHECK_VERSION(2,32,0)
 		g_thread_create (rig_daemon_cycle, NULL, FALSE, &err);
+#else
+    thread = g_thread_try_new ("daemon thread", rig_daemon_cycle, NULL, &err);
+    if (thread != NULL) {
+      g_thread_unref(thread);
+    }
+#endif
 
 		/* check whether any error occurred when starting the daemon
 		   thread; if yes, close rig and return with error code