diff options
author | Andy Hertzfeld <andy@src.gnome.org> | 2001-03-23 01:47:45 +0000 |
---|---|---|
committer | Andy Hertzfeld <andy@src.gnome.org> | 2001-03-23 01:47:45 +0000 |
commit | 862bed04fd10de7f5be17222baf8b18e398f9010 (patch) | |
tree | f7b0b8b8fee80ce2a3f3e7eab49f9b580d671479 | |
parent | e95421bc04880bb731f01f96ad2290efcda4e44f (diff) | |
download | nautilus-862bed04fd10de7f5be17222baf8b18e398f9010.tar.gz |
fixed race condition problem in the digest queuing
* libnautilus-extensions/nautilus-annotation.c:
(calculate_checksum_callback), (process_digest_requests),
(queue_file_digest_request):
fixed race condition problem in the digest queuing
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-annotation.c | 12 | ||||
-rw-r--r-- | libnautilus-private/nautilus-annotation.c | 12 |
3 files changed, 22 insertions, 10 deletions
@@ -1,5 +1,13 @@ 2001-03-22 Andy Hertzfeld <andy@eazel.com> + + * libnautilus-extensions/nautilus-annotation.c: + (calculate_checksum_callback), (process_digest_requests), + (queue_file_digest_request): + fixed race condition problem in the digest queuing + +2001-03-22 Andy Hertzfeld <andy@eazel.com> + merged with head to create post-1_0_8 branch * Makefile.am: diff --git a/libnautilus-extensions/nautilus-annotation.c b/libnautilus-extensions/nautilus-annotation.c index be8643bf0..8ec679971 100644 --- a/libnautilus-extensions/nautilus-annotation.c +++ b/libnautilus-extensions/nautilus-annotation.c @@ -471,7 +471,9 @@ calculate_checksum_callback (GnomeVFSAsyncHandle *handle, } /* accumulate the recently read data into the checksum */ - md5_update (&digest_handle->digest_context, buffer, bytes_read); + if (bytes_read > 0) { + md5_update (&digest_handle->digest_context, buffer, bytes_read); + } /* Read more unless we are at the end of the file. */ if (bytes_read > 0 && result == GNOME_VFS_OK) { @@ -572,9 +574,9 @@ process_digest_requests (void) /* dispose of queue entry */ nautilus_file_unref (file); - g_list_free_1 (current_entry); - - digests_in_progress += 1; + + g_list_free_1 (current_entry); + digests_in_progress += 1; } } @@ -589,7 +591,7 @@ queue_file_digest_request (NautilusFile *file) return; } nautilus_file_ref (file); - digest_request_queue = g_list_prepend (digest_request_queue, file); + digest_request_queue = g_list_append (digest_request_queue, file); process_digest_requests (); } diff --git a/libnautilus-private/nautilus-annotation.c b/libnautilus-private/nautilus-annotation.c index be8643bf0..8ec679971 100644 --- a/libnautilus-private/nautilus-annotation.c +++ b/libnautilus-private/nautilus-annotation.c @@ -471,7 +471,9 @@ calculate_checksum_callback (GnomeVFSAsyncHandle *handle, } /* accumulate the recently read data into the checksum */ - md5_update (&digest_handle->digest_context, buffer, bytes_read); + if (bytes_read > 0) { + md5_update (&digest_handle->digest_context, buffer, bytes_read); + } /* Read more unless we are at the end of the file. */ if (bytes_read > 0 && result == GNOME_VFS_OK) { @@ -572,9 +574,9 @@ process_digest_requests (void) /* dispose of queue entry */ nautilus_file_unref (file); - g_list_free_1 (current_entry); - - digests_in_progress += 1; + + g_list_free_1 (current_entry); + digests_in_progress += 1; } } @@ -589,7 +591,7 @@ queue_file_digest_request (NautilusFile *file) return; } nautilus_file_ref (file); - digest_request_queue = g_list_prepend (digest_request_queue, file); + digest_request_queue = g_list_append (digest_request_queue, file); process_digest_requests (); } |