[glib] measure_disk_usage: skip progress on NULL callback
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] measure_disk_usage: skip progress on NULL callback
- Date: Tue, 17 Sep 2013 13:44:52 +0000 (UTC)
commit dbf95a5ae94441dc235d8dcf003f05cb5c6bd84b
Author: Ryan Lortie <desrt desrt ca>
Date: Tue Sep 17 09:40:04 2013 -0400
measure_disk_usage: skip progress on NULL callback
In the real_..._async wrapper for GFile.measure_disk_usage, skip the
wrapping of the progress callback in the case that the user gave a NULL
callback to the async function. This is a performance improvement
because the sync version won't have to do continuous sampling of the
clock to issue a call to the wrapper which will then do nothing.
Unfortunately, I made this simplifying assumption when writing the
wrapper, but forgot to actually implement it when making the sync call.
As a result, the wrapper is still called, and invokes the NULL callback,
causing a segfault.
Make sure we pass NULL if the user's callback was NULL.
https://bugzilla.gnome.org/show_bug.cgi?id=707787
gio/gfile.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gio/gfile.c b/gio/gfile.c
index 0c95942..d321c24 100644
--- a/gio/gfile.c
+++ b/gio/gfile.c
@@ -7453,7 +7453,7 @@ measure_disk_usage_thread (GTask *task,
MeasureResult result;
if (g_file_measure_disk_usage (source_object, data->flags, cancellable,
- measure_disk_usage_progress, task,
+ data->progress_callback ? measure_disk_usage_progress : NULL, task,
&result.disk_usage, &result.num_dirs, &result.num_files,
&error))
g_task_return_pointer (task, g_memdup (&result, sizeof result), g_free);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]