From 9061615ec69e00c3f7b96ae69faf25725ceee03c Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 13 Jun 2014 01:27:39 -0700 Subject: [PATCH] Remove CEF message loop running to client. Running CEF message loop inside wxWebviewChromium internal will get segument fault, while moving to client doesn't. Reset to the previous client solution to avoid segument falut, since I don't figure out the segument fault reason. --- include/wx/webview_chromium.h | 2 +- samples/webview_chromium/webview.cpp | 7 +++++++ src/common/webview_chromium.cpp | 3 +-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/wx/webview_chromium.h b/include/wx/webview_chromium.h index 194a2513c3..81e2fbd215 100644 --- a/include/wx/webview_chromium.h +++ b/include/wx/webview_chromium.h @@ -221,7 +221,7 @@ public: // If using a separate subprocess then return the result of this function static int StartUpSubprocess(); static void Shutdown(); - static void RunCEFMessageLoopOnIdle(wxIdleEvent& event); + static void RunCEFMessageLoopOnIdle(); protected: virtual void DoSetPage(const wxString& html, const wxString& baseUrl); diff --git a/samples/webview_chromium/webview.cpp b/samples/webview_chromium/webview.cpp index 509f6c3ddb..d82b23c0a2 100644 --- a/samples/webview_chromium/webview.cpp +++ b/samples/webview_chromium/webview.cpp @@ -72,6 +72,7 @@ public: virtual bool OnInit(); virtual int OnExit(); + virtual bool ProcessIdle(); /* #if wxUSE_CMDLINE_PARSER @@ -267,6 +268,12 @@ int WebApp::OnExit() return wxApp::OnExit(); } +bool WebApp::ProcessIdle() { + wxWebViewChromium::RunCEFMessageLoopOnIdle(); + return wxApp::ProcessIdle(); +} + + WebFrame::WebFrame(const wxString& url) : wxFrame(NULL, wxID_ANY, "wxWebView Sample") { diff --git a/src/common/webview_chromium.cpp b/src/common/webview_chromium.cpp index e2d1f5e439..24bc9a2db8 100644 --- a/src/common/webview_chromium.cpp +++ b/src/common/webview_chromium.cpp @@ -106,7 +106,6 @@ bool wxWebViewChromium::Create(wxWindow* parent, #endif this->Bind(wxEVT_SIZE, &wxWebViewChromium::OnSize, this); - this->Bind(wxEVT_IDLE, &wxWebViewChromium::RunCEFMessageLoopOnIdle); m_parent->DoAddChild( this ); PostCreation(size); return true; @@ -458,7 +457,7 @@ int wxWebViewChromium::StartUpSubprocess() return CefExecuteProcess(args, NULL); } -void wxWebViewChromium::RunCEFMessageLoopOnIdle(wxIdleEvent& event) +void wxWebViewChromium::RunCEFMessageLoopOnIdle() { CefDoMessageLoopWork(); }