Regarding the tash not getting run:
The task posted at the link that you provided is explicitly bound to a WeakPtr to the |tracker_| - are you sure that the |tracker_| isn't getting deleted before the UI thread gets around to processing that task (i.e. things working-as-intended with regard to coping with asynchronous teardown).
Regarding this code's threading:
The code is PostTask()ing to the |tracker_| via a reference from AsWeakPtr(). The posting class actually owns |tracker_|, though, and holds it in a DeleteOnUiThread containing. This means the code is either doing unnecessary work, or is racy/broken:
- If we only ever post these tasks from the same thread on which the calling code is torn-down then all the posted tasks are well-serialized, so we don't even need to use WeakPtrs - we are already guaranteed that the work posting tasks will be processed in-order with the |tracker_| deletion task.
- If we post these tasks from some other capture threads then we cannot rely on this ordering, and in that case we should also not be relying on |tracker_| still being valid even at the time of the PostTask() call, let alone when the task is actually being processed.
There may be some surrounding ordering constraints arising from specifics of the calling code that make this safe, but at a glance something does look amiss.