diff --git a/dom/media/systemservices/CamerasChild.cpp b/dom/media/systemservices/CamerasChild.cpp index cb0e16047df7..240d16b40b27 100644 --- a/dom/media/systemservices/CamerasChild.cpp +++ b/dom/media/systemservices/CamerasChild.cpp @@ -486,23 +486,20 @@ Shutdown(void) class ShutdownRunnable : public Runnable { public: - ShutdownRunnable(RefPtr aReplyEvent, - nsIThread* aReplyThread) - : mReplyEvent(aReplyEvent), mReplyThread(aReplyThread) {}; + ShutdownRunnable(RefPtr aReplyEvent) + : mReplyEvent(aReplyEvent) {}; NS_IMETHOD Run() override { LOG(("Closing BackgroundChild")); ipc::BackgroundChild::CloseForCurrentThread(); - LOG(("PBackground thread exists, shutting down thread")); - mReplyThread->Dispatch(mReplyEvent, NS_DISPATCH_NORMAL); + NS_DispatchToMainThread(mReplyEvent); return NS_OK; } private: RefPtr mReplyEvent; - nsIThread* mReplyThread; }; void @@ -548,8 +545,7 @@ CamerasChild::ShutdownChild() // BackgroundChild is closed. RefPtr event = new ThreadDestructor(CamerasSingleton::Thread()); - RefPtr runnable = - new ShutdownRunnable(event, NS_GetCurrentThread()); + RefPtr runnable = new ShutdownRunnable(event); CamerasSingleton::Thread()->Dispatch(runnable, NS_DISPATCH_NORMAL); } else { LOG(("Shutdown called without PBackground thread"));