Bug 26107

Summary: Various fixes to the state of CodecOffers including correctly replacing and freeing them.
Product: Telepathy Reporter: Mike Ruprecht <cmaiku>
Component: gabbleAssignee: Sjoerd Simons <sjoerd>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://git.collabora.co.uk/?p=user/maiku/telepathy-gabble.git;a=shortlog;h=refs/heads/replace-codecoffers
Whiteboard:
i915 platform: i915 features:

Description Mike Ruprecht 2010-01-18 17:03:27 UTC
See summary.
Comment 1 Sjoerd Simons 2010-01-20 06:15:41 UTC
38385c5f834eb8f1616d9992de97504518da12c9

* The new code in dispose should never be hit. the AsyncResult will have a ref on the codec offer. 
* When getting cancelled, please unregister the object from the bus right away. To be sure you don't get accept or reject called afterwards

e89cf68b0c247ac2974560be771b35a5ccdca44c
  * You're leaking the cancellable when switching offers
  * In general it's not guaranteed that if you cancel an async function the result will be an error. 
    So check earlier whether it was an old or a new offer. 
  
88bd1dc580f15585dc6bacb64be336c27f9762ac
  Implementing it like this will fuck up your refounting if you switch codec offers while deinitting. Imagine 
  the following sequence:
     * A codec offer is started
     * A new one is started, the old one gets cancelled
     * the stream gets deinitialized. the last codec offer gets cancelled as well, so there are now 
       two cancelled operations that haven't returned just yet. _finished_cb will get called twice,
      dropping the last ref the first time and using a disposed object the second time...


Also when calling deinit on the contact it should make itself drop of the bus asap and also make its streams do the same.
Comment 2 Mike Ruprecht 2010-01-20 20:04:15 UTC
Updated my branch per your review comments.
Comment 3 Sjoerd Simons 2010-01-21 03:57:14 UTC
Your refcounting it still potentially racy. Although in practise it works as the older offers cancellation will come through first.  A slightly more elegant solution would be appreciated though
Comment 4 Mike Ruprecht 2010-01-21 19:25:14 UTC
Updated the branch per your review comments.
Comment 5 Sjoerd Simons 2010-01-22 06:46:35 UTC
Looks fine, merging

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.