gnome-screensaver r1656 - in trunk: . src



Author: mccann
Date: Tue Apr 14 01:54:46 2009
New Revision: 1656
URL: http://svn.gnome.org/viewvc/gnome-screensaver?rev=1656&view=rev

Log:
2009-04-13  William Jon McCann  <jmccann redhat com>

	* src/gnome-screensaver-preferences.c (get_best_visual):
	* src/gs-job.c (command_watch):
	* src/gs-manager.c (get_gconf_client):
	* src/gs-window-x11.c (error_watch), (keyboard_command_watch),
	(lock_command_watch):
	Fix misc problems with the use of GError,
	mostly leaking the error on the error path.

	Patch from: Paolo Borelli <pborelli katamail com>
	Fixes #572955



Modified:
   trunk/ChangeLog
   trunk/src/gnome-screensaver-preferences.c
   trunk/src/gs-job.c
   trunk/src/gs-manager.c
   trunk/src/gs-window-x11.c

Modified: trunk/src/gnome-screensaver-preferences.c
==============================================================================
--- trunk/src/gnome-screensaver-preferences.c	(original)
+++ trunk/src/gnome-screensaver-preferences.c	Tue Apr 14 01:54:46 2009
@@ -1327,17 +1327,24 @@
         unsigned long v;
         char          c;
         GdkVisual    *visual;
+        gboolean      res;
 
         visual = NULL;
 
         command = g_build_filename (LIBEXECDIR, "gnome-screensaver-gl-helper", NULL);
 
         error = NULL;
-        g_spawn_command_line_sync (command,
-                                   &std_output,
-                                   NULL,
-                                   &exit_status,
-                                   &error);
+        res = g_spawn_command_line_sync (command,
+                                         &std_output,
+                                         NULL,
+                                         &exit_status,
+                                         &error);
+
+        if (! res) {
+                g_debug ("Could not run command '%s': %s", command, error->message);
+                g_error_free (error);
+                goto out;
+        }
 
         if (1 == sscanf (std_output, "0x%lx %c", &v, &c)) {
                 if (v != 0) {
@@ -1351,7 +1358,9 @@
                 }
         }
 
+ out:
         g_free (std_output);
+        g_free (command);
 
         return visual;
 }

Modified: trunk/src/gs-job.c
==============================================================================
--- trunk/src/gs-job.c	(original)
+++ trunk/src/gs-job.c	Tue Apr 14 01:54:46 2009
@@ -386,12 +386,16 @@
 
                 status = g_io_channel_read_line (source, &str, NULL, NULL, &error);
 
-		if (status == G_IO_STATUS_NORMAL) {
+                if (status == G_IO_STATUS_NORMAL) {
                         gs_debug ("command output: %s", str);
 
-		} else if (status == G_IO_STATUS_EOF) {
+                } else if (status == G_IO_STATUS_EOF) {
                         done = TRUE;
-		}
+
+                } else if (error != NULL) {
+                        gs_debug ("command error: %s", error->message);
+                        g_error_free (error);
+                }
 
                 g_free (str);
         } else if (condition & G_IO_HUP) {

Modified: trunk/src/gs-manager.c
==============================================================================
--- trunk/src/gs-manager.c	(original)
+++ trunk/src/gs-manager.c	Tue Apr 14 01:54:46 2009
@@ -995,6 +995,7 @@
         engine = gconf_engine_get_for_addresses (addresses, &error);
         if (engine == NULL) {
                 gs_debug ("Unable to get gconf engine for addresses: %s", error->message);
+                g_error_free (error);
         } else {
                 client = gconf_client_get_for_engine (engine);
         }

Modified: trunk/src/gs-window-x11.c
==============================================================================
--- trunk/src/gs-window-x11.c	(original)
+++ trunk/src/gs-window-x11.c	Tue Apr 14 01:54:46 2009
@@ -970,6 +970,7 @@
                 case G_IO_STATUS_ERROR:
                         finished = TRUE;
                         gs_debug ("Error reading from child: %s\n", error->message);
+                        g_error_free (error);
                         return FALSE;
                 case G_IO_STATUS_AGAIN:
                 default:
@@ -1282,6 +1283,7 @@
                 case G_IO_STATUS_ERROR:
                         finished = TRUE;
                         gs_debug ("Error reading from child: %s\n", error->message);
+                        g_error_free (error);
                         return FALSE;
                 case G_IO_STATUS_AGAIN:
                 default:
@@ -1463,6 +1465,7 @@
                 case G_IO_STATUS_ERROR:
                         finished = TRUE;
                         gs_debug ("Error reading from child: %s\n", error->message);
+                        g_error_free (error);
                         return FALSE;
                 case G_IO_STATUS_AGAIN:
                 default:



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