Fix crash on shutdown due to CefProcess not being destroyed immediately (issue #277).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@400 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
8bf0248429
commit
9fd169d16c
|
@ -855,7 +855,7 @@ bool CefContext::Initialize(const CefSettings& settings,
|
|||
crypto::EnsureNSPRInit();
|
||||
#endif
|
||||
|
||||
process_ = new CefProcess(settings_.multi_threaded_message_loop);
|
||||
process_.reset(new CefProcess(settings_.multi_threaded_message_loop));
|
||||
process_->CreateChildThreads();
|
||||
|
||||
initialized_ = true;
|
||||
|
@ -889,7 +889,7 @@ void CefContext::Shutdown()
|
|||
browser_shutdown_event.Wait();
|
||||
|
||||
// Delete the process to destroy the child threads.
|
||||
process_ = NULL;
|
||||
process_.reset(NULL);
|
||||
|
||||
// Block until UI thread shutdown is complete.
|
||||
uithread_shutdown_event.Wait();
|
||||
|
@ -898,7 +898,7 @@ void CefContext::Shutdown()
|
|||
UIT_FinishShutdown(NULL, NULL);
|
||||
|
||||
// Delete the process to destroy the child threads.
|
||||
process_ = NULL;
|
||||
process_.reset(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
// Returns true if the context is shutting down.
|
||||
bool shutting_down() { return shutting_down_; }
|
||||
|
||||
scoped_refptr<CefProcess> process() { return process_; }
|
||||
CefProcess* process() { return process_.get(); }
|
||||
|
||||
bool AddBrowser(CefRefPtr<CefBrowserImpl> browser);
|
||||
bool RemoveBrowser(CefRefPtr<CefBrowserImpl> browser);
|
||||
|
@ -88,7 +88,7 @@ private:
|
|||
bool shutting_down_;
|
||||
|
||||
// Manages the various process threads.
|
||||
scoped_refptr<CefProcess> process_;
|
||||
scoped_ptr<CefProcess> process_;
|
||||
|
||||
// Initialize the AtExitManager on the main application thread to avoid
|
||||
// asserts and possible memory leaks.
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/threading/thread.h"
|
||||
|
||||
CefProcess* g_cef_process = NULL;
|
||||
|
||||
// Class used to process events on the current message loop.
|
||||
class CefMessageLoopForUI : public MessageLoopForUI
|
||||
{
|
||||
|
@ -67,7 +65,6 @@ CefProcess::CefProcess(bool multi_threaded_message_loop)
|
|||
created_ui_thread_(false),
|
||||
created_io_thread_(false),
|
||||
created_file_thread_(false) {
|
||||
g_cef_process = this;
|
||||
}
|
||||
|
||||
CefProcess::~CefProcess() {
|
||||
|
@ -87,8 +84,6 @@ CefProcess::~CefProcess() {
|
|||
// Terminate the message loop.
|
||||
ui_message_loop_.reset();
|
||||
}
|
||||
|
||||
g_cef_process = NULL;
|
||||
}
|
||||
|
||||
void CefProcess::DoMessageLoopIteration() {
|
||||
|
|
|
@ -32,8 +32,7 @@ class CefMessageLoopForUI;
|
|||
|
||||
// NOT THREAD SAFE, call only from the main thread.
|
||||
// These functions shouldn't return NULL unless otherwise noted.
|
||||
class CefProcess : public base::RefCounted<CefProcess>,
|
||||
public base::NonThreadSafe {
|
||||
class CefProcess : public base::NonThreadSafe {
|
||||
public:
|
||||
CefProcess(bool multi_threaded_message_loop);
|
||||
virtual ~CefProcess();
|
||||
|
@ -116,6 +115,4 @@ class CefProcess : public base::RefCounted<CefProcess>,
|
|||
DISALLOW_COPY_AND_ASSIGN(CefProcess);
|
||||
};
|
||||
|
||||
extern CefProcess* g_cef_process;
|
||||
|
||||
#endif // _CEF_PROCESS_H
|
||||
|
|
Loading…
Reference in New Issue