<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 23, 2014 at 11:15 PM, Jonathon Jongsma <span dir="ltr"><<a href="mailto:jjongsma@redhat.com" target="_blank">jjongsma@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":1s7" class="a3s" style="overflow:hidden">Hm, I agree that the existing code does look very suspicious, but in general I think that ensuring that a ref is held for the duration of the async operation is probably a good idea.  From a very cursory investigation it looks like the spice_usb_device_manager_remove_dev() call path could be problematic. This ends up calling spice_win_usb_driver_uninstall() and then removing the device (via g_ptr_array_remove()), which could end up dropping the final ref on the object. Then you'd have a dead object in the uninstall_cb callback.  Granted, the existing code doesn't appear to be safe in this scenario either...</div>
</blockquote></div><br></div><div class="gmail_extra">I agree with you that you must be careful to hold a ref to your object during async. But the current ref/unref is useless and suspicious. So it should be removed in its current form. Feel free to improve the code for most safety, this is not my goal with this patch.<br>
</div><div class="gmail_extra"><br clear="all"><br>-- <br>Marc-André Lureau
</div></div>