Make UiThread use weak_ptr instead of raw pointer.