mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Windows: Fix DCHECKs during shutdown with multi-threaded message loop mode (issue #2362)
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "libcef/renderer/content_renderer_client.h"
|
||||
#include "libcef/utility/content_utility_client.h"
|
||||
|
||||
#include "base/at_exit.h"
|
||||
#include "base/base_switches.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_path.h"
|
||||
@@ -281,6 +282,14 @@ class CefUIThread : public base::Thread {
|
||||
browser_runner_->Shutdown();
|
||||
browser_runner_.reset(NULL);
|
||||
|
||||
// Release MessagePump resources registered with the AtExitManager.
|
||||
base::MessageLoop* ml = const_cast<base::MessageLoop*>(message_loop());
|
||||
base::MessageLoopCurrent::UnbindFromCurrentThreadInternal(ml);
|
||||
ml->ReleasePump();
|
||||
|
||||
// Run exit callbacks on the UI thread to avoid sequence check failures.
|
||||
base::AtExitManager::ProcessCallbacksNow();
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Closes the COM library on the current thread. CoInitialize must
|
||||
// be balanced by a corresponding call to CoUninitialize.
|
||||
@@ -635,13 +644,14 @@ void CefMainDelegate::ShutdownBrowser() {
|
||||
browser_runner_->Shutdown();
|
||||
browser_runner_.reset(NULL);
|
||||
}
|
||||
|
||||
message_loop_.reset();
|
||||
|
||||
if (ui_thread_.get()) {
|
||||
// Blocks until the thread has stopped.
|
||||
ui_thread_->Stop();
|
||||
ui_thread_.reset();
|
||||
}
|
||||
|
||||
message_loop_.reset();
|
||||
}
|
||||
|
||||
void CefMainDelegate::InitializeResourceBundle() {
|
||||
|
Reference in New Issue
Block a user