anjuta r3714 - in trunk: . plugins/document-manager



Author: naba
Date: Mon Feb 25 22:31:45 2008
New Revision: 3714
URL: http://svn.gnome.org/viewvc/anjuta?rev=3714&view=rev

Log:
	* plugins/document-manager/plugin.c: (on_docman_auto_save): Fixed a
	crash when there is a modified new file open, a non-modified exiting
	file open and autosave happen. Simplified error checking logic and
	avoided memory corruption. Fixes bug #Bug 518716.


Modified:
   trunk/ChangeLog
   trunk/plugins/document-manager/plugin.c

Modified: trunk/plugins/document-manager/plugin.c
==============================================================================
--- trunk/plugins/document-manager/plugin.c	(original)
+++ trunk/plugins/document-manager/plugin.c	Mon Feb 25 22:31:45 2008
@@ -1489,7 +1489,6 @@
 on_docman_auto_save (gpointer data)
 {
 	gboolean retval;
-	const gchar *mesg;
 	AnjutaPreferences* prefs;
 	DocmanPlugin *plugin;
 	AnjutaDocman *docman;
@@ -1521,24 +1520,23 @@
 			if (ianjuta_file_savable_is_dirty (IANJUTA_FILE_SAVABLE (doc), NULL))
 			{
 				gchar *uri;
-				GError *err;
 				uri = ianjuta_file_get_uri (IANJUTA_FILE (doc), NULL);
 				if (uri)
 				{
+					GError *err = NULL;
+
 					g_free (uri);
-					err = NULL;
 					ianjuta_file_savable_save (IANJUTA_FILE_SAVABLE (doc), &err);
-				}
-				if (!uri || err)
-				{
-					gchar *fullmsg;
-					mesg = ianjuta_document_get_filename (doc, NULL);	/* this may fail, too */
-					fullmsg = g_strdup_printf (_("Autosave failed for %s"), mesg);
-					anjuta_status (status, fullmsg, 3);
-					g_free (fullmsg);
 					if (err)
+					{
+						gchar *fullmsg;
+						const gchar *filename = ianjuta_document_get_filename (doc, NULL); /* this may fail, too */
+						fullmsg = g_strdup_printf (_("Autosave failed for file %s: %s"), filename, err->message);
+						anjuta_status (status, fullmsg, 3);
+						g_free (fullmsg);
 						g_error_free (err);
-					retval = FALSE;
+						retval = FALSE;
+					}
 				}
 			}
 		}



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