1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 01:57:52 +00:00

(gtk) silence a g_object_unref() warning when appending '.added' to a .torrent file fails

This commit is contained in:
Jordan Lee 2013-01-17 00:45:31 +00:00
parent c385a1559f
commit bff4a98fa6

View file

@ -656,14 +656,19 @@ get_file_mtime (GFile * file)
static void
rename_torrent_and_unref_file (GFile * file)
{
GError * error = NULL;
GFileInfo * info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME, 0, NULL, NULL);
const char * old_name = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME);
char * new_name = g_strdup_printf ("%s.added", old_name);
GFile * new_file = g_file_set_display_name (file, new_name, NULL, NULL);
g_object_unref (G_OBJECT (new_file));
GFile * new_file = g_file_set_display_name (file, new_name, NULL, &error);
if (error != NULL)
g_message ("Unable to rename \"%s\" as \"%s\": %s", old_name, new_name, error->message);
if (new_file != NULL)
g_object_unref (G_OBJECT (new_file));
g_free (new_name);
g_object_unref (G_OBJECT (info));
g_object_unref (G_OBJECT (file));
g_clear_error (&error);
}
static gboolean