[rygel] core: Only keep the continuation when needed



commit 4c7814e13fd7ed28ae32f619ccdd3031762bb8a3
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri May 14 17:33:23 2010 +0300

    core: Only keep the continuation when needed
    
    We should set the continuation just before defering to mainloop and unset
    it as soon as we are back from it so that continuation doesn't get called
    from unwanted contexts.

 src/rygel/rygel-seekable-response.vala |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/rygel/rygel-seekable-response.vala b/src/rygel/rygel-seekable-response.vala
index 7718c39..6b6f750 100644
--- a/src/rygel/rygel-seekable-response.vala
+++ b/src/rygel/rygel-seekable-response.vala
@@ -118,7 +118,6 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
                                         this.bytes_to_read (),
                                         this.priority,
                                         this.cancellable);
-        this.run_continue = read_contents.callback;
         this.msg.wrote_chunk.connect ((msg) => {
             if (this.run_continue != null) {
                 this.run_continue ();
@@ -129,9 +128,11 @@ internal class Rygel.SeekableResponse : Rygel.HTTPResponse {
             this.push_data (this.buffer, bytes_read);
             this.total_length -= bytes_read;
 
+            this.run_continue = read_contents.callback;
             // We return from this call when wrote_chunk signal is emitted
             // and the handler we installed before the loop is called for it.
             yield;
+            this.run_continue = null;
 
             if (this.cancellable != null && this.cancellable.is_cancelled ()) {
                 break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]