Re: [Vala] libsoup Session.Async does not send stuff



I think I got it now. It looks like
a libsoup vapi bug.

After looking at the generated C more carefully,
I find that closure doesn't work with queue_message
at all!

The closure is created like this:

    _data1_ = g_slice_new0 (Block1Data);
    _data1_->_ref_count_ = 1;

the call to queue_message is compiled to this:

    soup_session_queue_message ((SoupSession*) session, _tmp22_,
___lambda2__soup_session_callback, _data1_);

   /* Note: there is NO g_object_ref(_data1_) before the call,
      and soup_session_queue_message simply treat
      _data1_ as typeless blob.

      Hence, refcount is still 1 */

at the end of the scope, the entire closure
is destroyed like this:

    block1_data_unref (_data1_);  // recursively unref everything
    _data1_ = NULL;

Hence, by the time the lambda executes, the closure has
already gone.


Nice day
Nor Jaidi Tuah





PRIVILEGED/CONFIDENTIAL information may be contained in this message. If you are neither the addressee 
(intended recipient) nor an authorised recipient of the addressee, and have received this message in error, 
please destroy this message (including attachments) and notify the sender immediately. STRICT PROHIBITION: 
This message, whether in part or in whole, should not be reviewed, retained, copied, reused, disclosed, 
distributed or used for any purpose whatsoever. Such unauthorised use may be unlawful and may contain 
material protected by the Official Secrets Act (Cap 153) of the Laws of Brunei Darussalam. DISCLAIMER: 
We/This Department/The Government of Brunei Darussalam, accept[s] no responsibility for loss or damage 
arising from the use of this message in any manner whatsoever. Our messages are checked for viruses but we do 
not accept liability for any viruses which may be transmitted in or with this message.


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