Fix race with multi-threaded message loop (fixes issue #2668).
Remove the local thread object in favor of setting the ui_thread_ field directly. This avoids the race between ui_thread_.swap(thread) and CefUIThread::InitializeBrowserRunner.
This commit is contained in:
parent
17ec55a3b3
commit
1086495096
|
@ -723,11 +723,9 @@ int CefMainDelegate::RunProcess(
|
|||
bool CefMainDelegate::CreateUIThread(base::OnceClosure setup_callback) {
|
||||
DCHECK(!ui_thread_);
|
||||
|
||||
std::unique_ptr<CefUIThread> thread;
|
||||
thread.reset(new CefUIThread(std::move(setup_callback)));
|
||||
thread->Start();
|
||||
thread->WaitUntilThreadStarted();
|
||||
ui_thread_.swap(thread);
|
||||
ui_thread_.reset(new CefUIThread(std::move(setup_callback)));
|
||||
ui_thread_->Start();
|
||||
ui_thread_->WaitUntilThreadStarted();
|
||||
|
||||
InitMessagePumpFactoryForUI();
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue