Skip to content
Permalink
Browse files
[WPE] TestWebKitFindController asserts
https://bugs.webkit.org/show_bug.cgi?id=181472

Reviewed by Carlos Garcia Campos.

Let's fix this in two independent ways.

First, use a GRefPtr to hold ownership of the WebKitWebViewBackend. This way, we don't need
to change the order in which WebKitWebView destroys its priv struct members from what is
used in WebKitGTK+, which can lead to odd bugs.

Additionally, just for good measure, stop resetting the find client when disposing
WebKitFindController. This is unnecessary because it will never be destroyed before the
WebKitWebView.

* UIProcess/API/glib/WebKitFindController.cpp:
(webkit_find_controller_class_init):
(webkitFindControllerDispose): Deleted.
* UIProcess/API/glib/WebKitWebView.cpp:
(_WebKitWebViewPrivate::~_WebKitWebViewPrivate):
(webkitWebViewSetProperty):
(webkitWebViewGetProperty):
(webkitWebViewCreatePage):
(webkit_web_view_get_backend):
* UIProcess/API/wpe/WebKitWebViewBackend.cpp:
(webkitWebViewBackendCreateDefault):
(WTF::refGPtr):
(WTF::derefGPtr):
* UIProcess/API/wpe/WebKitWebViewBackendPrivate.h:

Canonical link: https://commits.webkit.org/197818@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227418 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Michael Catanzaro committed Jan 23, 2018
1 parent 9d53462 commit 719201110fdcc25d8720f15d111d6476a3683803
@@ -1,3 +1,35 @@
2018-01-23 Michael Catanzaro <mcatanzaro@igalia.com>

[WPE] TestWebKitFindController asserts
https://bugs.webkit.org/show_bug.cgi?id=181472

Reviewed by Carlos Garcia Campos.

Let's fix this in two independent ways.

First, use a GRefPtr to hold ownership of the WebKitWebViewBackend. This way, we don't need
to change the order in which WebKitWebView destroys its priv struct members from what is
used in WebKitGTK+, which can lead to odd bugs.

Additionally, just for good measure, stop resetting the find client when disposing
WebKitFindController. This is unnecessary because it will never be destroyed before the
WebKitWebView.

* UIProcess/API/glib/WebKitFindController.cpp:
(webkit_find_controller_class_init):
(webkitFindControllerDispose): Deleted.
* UIProcess/API/glib/WebKitWebView.cpp:
(_WebKitWebViewPrivate::~_WebKitWebViewPrivate):
(webkitWebViewSetProperty):
(webkitWebViewGetProperty):
(webkitWebViewCreatePage):
(webkit_web_view_get_backend):
* UIProcess/API/wpe/WebKitWebViewBackend.cpp:
(webkitWebViewBackendCreateDefault):
(WTF::refGPtr):
(WTF::derefGPtr):
* UIProcess/API/wpe/WebKitWebViewBackendPrivate.h:

2018-01-22 Jon Lee <jonlee@apple.com>

Update title label size
@@ -132,14 +132,6 @@ class FindClient final : public API::FindClient {
WebKitFindController* m_findController;
};

static void webkitFindControllerDispose(GObject* object)
{
WebKitFindController* findController = WEBKIT_FIND_CONTROLLER(object);
getPage(findController).setFindClient(nullptr);

G_OBJECT_CLASS(webkit_find_controller_parent_class)->dispose(object);
}

static void webkitFindControllerConstructed(GObject* object)
{
G_OBJECT_CLASS(webkit_find_controller_parent_class)->constructed(object);
@@ -186,7 +178,6 @@ static void webkitFindControllerSetProperty(GObject* object, guint propId, const
static void webkit_find_controller_class_init(WebKitFindControllerClass* findClass)
{
GObjectClass* gObjectClass = G_OBJECT_CLASS(findClass);
gObjectClass->dispose = webkitFindControllerDispose;
gObjectClass->constructed = webkitFindControllerConstructed;
gObjectClass->get_property = webkitFindControllerGetProperty;
gObjectClass->set_property = webkitFindControllerSetProperty;
@@ -198,14 +198,10 @@ struct _WebKitWebViewPrivate {
// For modal dialogs, make sure the main loop is stopped when finalizing the webView.
if (modalLoop && g_main_loop_is_running(modalLoop.get()))
g_main_loop_quit(modalLoop.get());
#if PLATFORM(WPE)
view = nullptr;
webkitWebViewBackendUnref(backend);
#endif
}

#if PLATFORM(WPE)
WebKitWebViewBackend* backend;
GRefPtr<WebKitWebViewBackend> backend;
std::unique_ptr<WKWPE::View> view;
#endif

@@ -691,7 +687,7 @@ static void webkitWebViewSetProperty(GObject* object, guint propId, const GValue
#if PLATFORM(WPE)
case PROP_BACKEND: {
gpointer backend = g_value_get_boxed(value);
webView->priv->backend = backend ? static_cast<WebKitWebViewBackend*>(backend) : nullptr;
webView->priv->backend = backend ? adoptGRef(static_cast<WebKitWebViewBackend*>(backend)) : nullptr;
break;
}
#endif
@@ -739,7 +735,7 @@ static void webkitWebViewGetProperty(GObject* object, guint propId, GValue* valu
switch (propId) {
#if PLATFORM(WPE)
case PROP_BACKEND:
g_value_set_static_boxed(value, webView->priv->backend);
g_value_set_static_boxed(value, webView->priv->backend.get());
break;
#endif
case PROP_WEB_CONTEXT:
@@ -1983,7 +1979,7 @@ void webkitWebViewCreatePage(WebKitWebView* webView, Ref<API::PageConfiguration>
#if PLATFORM(GTK)
webkitWebViewBaseCreateWebPage(WEBKIT_WEB_VIEW_BASE(webView), WTFMove(configuration));
#elif PLATFORM(WPE)
webView->priv->view.reset(WKWPE::View::create(webkit_web_view_backend_get_wpe_backend(webView->priv->backend), configuration.get()));
webView->priv->view.reset(WKWPE::View::create(webkit_web_view_backend_get_wpe_backend(webView->priv->backend.get()), configuration.get()));
#endif
}

@@ -2430,7 +2426,7 @@ WebKitWebViewBackend* webkit_web_view_get_backend(WebKitWebView* webView)
{
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), nullptr);

return webView->priv->backend;
return webView->priv->backend.get();
}
#endif

@@ -82,11 +82,11 @@ void webkitWebViewBackendUnref(WebKitWebViewBackend* viewBackend)
}
}

WebKitWebViewBackend* webkitWebViewBackendCreateDefault()
GRefPtr<WebKitWebViewBackend> webkitWebViewBackendCreateDefault()
{
auto* viewBackend = static_cast<WebKitWebViewBackend*>(fastMalloc(sizeof(WebKitWebViewBackend)));
new (viewBackend) WebKitWebViewBackend();
return viewBackend;
return adoptGRef(viewBackend);
}

/**
@@ -129,3 +129,20 @@ struct wpe_view_backend* webkit_web_view_backend_get_wpe_backend(WebKitWebViewBa
g_return_val_if_fail(viewBackend, nullptr);
return viewBackend->backend;
}

namespace WTF {

template <> WebKitWebViewBackend* refGPtr(WebKitWebViewBackend* ptr)
{
if (ptr)
webkitWebViewBackendRef(ptr);
return ptr;
}

template <> void derefGPtr(WebKitWebViewBackend* ptr)
{
if (ptr)
webkitWebViewBackendUnref(ptr);
}

}
@@ -21,5 +21,14 @@

#include "WebKitWebViewBackend.h"

#include <wtf/glib/GRefPtr.h>

namespace WTF {

template <> WebKitWebViewBackend* refGPtr(WebKitWebViewBackend* ptr);
template <> void derefGPtr(WebKitWebViewBackend* ptr);

}

void webkitWebViewBackendUnref(WebKitWebViewBackend*);
WebKitWebViewBackend* webkitWebViewBackendCreateDefault();
GRefPtr<WebKitWebViewBackend> webkitWebViewBackendCreateDefault();

0 comments on commit 7192011

Please sign in to comment.