mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
(gtk) silence a g_object_unref() warning when appending '.added' to a .torrent file fails
This commit is contained in:
parent
c385a1559f
commit
bff4a98fa6
1 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue