Changeset 13797


Ignore:
Timestamp:
Jan 17, 2013, 12:45:31 AM (8 years ago)
Author:
jordan
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-core.c

    r13760 r13797  
    657657rename_torrent_and_unref_file (GFile * file)
    658658{
     659  GError * error = NULL;
    659660  GFileInfo * info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME, 0, NULL, NULL);
    660661  const char * old_name = g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME);
    661662  char * new_name = g_strdup_printf ("%s.added", old_name);
    662   GFile * new_file = g_file_set_display_name (file, new_name, NULL, NULL);
    663   g_object_unref (G_OBJECT (new_file));
     663  GFile * new_file = g_file_set_display_name (file, new_name, NULL, &error);
     664  if (error != NULL)
     665    g_message ("Unable to rename \"%s\" as \"%s\": %s", old_name, new_name, error->message);
     666  if (new_file != NULL)
     667    g_object_unref (G_OBJECT (new_file));
    664668  g_free (new_name);
    665669  g_object_unref (G_OBJECT (info));
    666670  g_object_unref (G_OBJECT (file));
     671  g_clear_error (&error);
    667672}
    668673
Note: See TracChangeset for help on using the changeset viewer.