From: Zeeshan Ali (Khattak) Date: Fri, 14 May 2010 14:33:23 +0000 (+0300) Subject: core: Only keep the continuation when needed X-Git-Tag: RYGEL_0_6_0~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c7814e13fd7ed28ae32f619ccdd3031762bb8a3;p=profile%2Fivi%2Frygel.git 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. --- 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;