More gio-du win32 fixes

Don't free the utf8 filename before the async function completes.

also, gitignore
This commit is contained in:
Ryan Lortie 2013-09-23 16:29:24 -04:00
parent 6d08d1191b
commit abf505fd0e
2 changed files with 5 additions and 5 deletions

View File

@ -69,6 +69,7 @@ gdbus-test-codegen-generated*
gdbus-test-fixture
gdbus-testserver
gdbus-threading
gio-du
g-file
g-file-info
g-icon

View File

@ -58,7 +58,7 @@ async_ready_func (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
const gchar *filename = user_data;
gchar *filename = user_data;
GError *error = NULL;
guint64 disk_usage;
guint64 num_dirs;
@ -67,6 +67,7 @@ async_ready_func (GObject *source,
g_file_measure_disk_usage_finish (G_FILE (source), result, &disk_usage, &num_dirs, &num_files, &error);
print_result (filename, disk_usage, num_dirs, num_files, error, '\n');
outstanding_asyncs--;
g_free (filename);
}
static void
@ -143,7 +144,7 @@ main (int argc, char **argv)
#else
while (argv[i])
{
gchar *argv_utf8 = argv[i];
gchar *argv_utf8 = g_strdup (argv[i]);
#endif
GFile *file = g_file_new_for_commandline_arg (argv_utf8);
@ -163,12 +164,10 @@ main (int argc, char **argv)
g_file_measure_disk_usage (file, flags, NULL, progress, argv_utf8,
&disk_usage, &num_dirs, &num_files, &error);
print_result (argv_utf8, disk_usage, num_dirs, num_files, error, '\n');
g_free (argv_utf8);
}
g_object_unref (file);
#ifdef G_OS_WIN32
g_free (argv_utf8);
#endif
i++;
}