mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-23 07:50:44 +01:00
Linux: Fix window destruction crash.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@449 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
8d6c760bbd
commit
3d734d9f90
@ -786,8 +786,11 @@ void CefBrowserImpl::UIT_DestroyBrowser()
|
||||
}
|
||||
|
||||
// Clean up anything associated with the WebViewHost widget.
|
||||
UIT_GetWebViewHost()->webwidget()->close();
|
||||
webviewhost_.reset();
|
||||
if (webviewhost_.get()) {
|
||||
if (webviewhost_->webwidget())
|
||||
webviewhost_->webwidget()->close();
|
||||
webviewhost_.reset();
|
||||
}
|
||||
|
||||
// Remove the reference to the window handle.
|
||||
UIT_ClearMainWndHandle();
|
||||
|
@ -18,6 +18,14 @@
|
||||
using WebKit::WebRect;
|
||||
using WebKit::WebSize;
|
||||
|
||||
namespace {
|
||||
|
||||
void window_destroyed(GtkWidget* widget, CefBrowserImpl* browser) {
|
||||
browser->UIT_DestroyBrowser();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void CefBrowserImpl::ParentWindowWillClose()
|
||||
{
|
||||
// TODO(port): Implement this method if necessary.
|
||||
@ -89,6 +97,8 @@ bool CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
||||
dev_tools_agent_->SetWebView(webviewhost_->webview());
|
||||
|
||||
window_info_.m_Widget = webviewhost_->view_handle();
|
||||
g_signal_connect(G_OBJECT(window_info_.m_Widget), "destroy",
|
||||
G_CALLBACK(window_destroyed), this);
|
||||
|
||||
Unlock();
|
||||
|
||||
@ -181,11 +191,8 @@ int CefBrowserImpl::UIT_GetPagesCount(WebKit::WebFrame* frame)
|
||||
// static
|
||||
void CefBrowserImpl::UIT_CloseView(gfx::NativeView view)
|
||||
{
|
||||
GtkWidget* window =
|
||||
gtk_widget_get_parent(gtk_widget_get_parent(GTK_WIDGET(view)));
|
||||
|
||||
MessageLoop::current()->PostTask(FROM_HERE, NewRunnableFunction(
|
||||
>k_widget_destroy, GTK_WIDGET(window)));
|
||||
GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(view));
|
||||
gtk_widget_destroy(window);
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -194,7 +194,6 @@ class WebWidgetHost {
|
||||
// ---------------------------------------------------------------------------
|
||||
static gfx::NativeView CreateWidget(gfx::NativeView parent_view,
|
||||
WebWidgetHost* host);
|
||||
void WindowDestroyed();
|
||||
void Resize(const gfx::Size& size);
|
||||
virtual void KeyEvent(GdkEventKey* event);
|
||||
#endif
|
||||
|
@ -84,8 +84,6 @@ class WebWidgetHostGtkWidget {
|
||||
G_CALLBACK(&HandleConfigure), host);
|
||||
g_signal_connect(widget, "expose-event",
|
||||
G_CALLBACK(&HandleExpose), host);
|
||||
g_signal_connect(widget, "destroy",
|
||||
G_CALLBACK(&HandleDestroy), host);
|
||||
g_signal_connect(widget, "key-press-event",
|
||||
G_CALLBACK(&HandleKeyPress), host);
|
||||
g_signal_connect(widget, "key-release-event",
|
||||
@ -154,16 +152,6 @@ class WebWidgetHostGtkWidget {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// The GdkWindow was destroyed.
|
||||
static gboolean HandleDestroy(GtkWidget* widget, void* unused) {
|
||||
// The associated WebWidgetHost instance may have already been destroyed.
|
||||
WebWidgetHost* host = static_cast<WebWidgetHost*>(
|
||||
g_object_get_data(G_OBJECT(widget), kWebWidgetHostKey));
|
||||
if (host)
|
||||
host->WindowDestroyed();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Keyboard key pressed.
|
||||
static gboolean HandleKeyPress(GtkWidget* widget,
|
||||
GdkEventKey* event,
|
||||
@ -455,10 +443,6 @@ void WebWidgetHost::PaintRect(const gfx::Rect& rect) {
|
||||
set_painting(false);
|
||||
}
|
||||
|
||||
void WebWidgetHost::WindowDestroyed() {
|
||||
delete this;
|
||||
}
|
||||
|
||||
void WebWidgetHost::SendKeyEvent(cef_key_type_t type, int key, int modifiers,
|
||||
bool sysChar, bool imeChar)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user