From 3e3ba1772c93011122dc2d0a074905f34f4104ff Mon Sep 17 00:00:00 2001 From: Philippe Normand Date: Fri, 11 Mar 2022 17:02:55 +0000 Subject: [PATCH] wpe: Reintroduce persistent WebContext A WebContext leak was introduced in MR https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2252. If we wanted one WebContext per WebView we should also unref the WebKitWebContext when destroying the WebView. This patch reintroduces the persistent WebContext, initially part of https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1484. Fixes #1084 Part-of: --- subprojects/gst-plugins-bad/ext/wpe/WPEThreadedView.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/wpe/WPEThreadedView.cpp b/subprojects/gst-plugins-bad/ext/wpe/WPEThreadedView.cpp index b85039c..0c10bc2 100644 --- a/subprojects/gst-plugins-bad/ext/wpe/WPEThreadedView.cpp +++ b/subprojects/gst-plugins-bad/ext/wpe/WPEThreadedView.cpp @@ -346,11 +346,13 @@ WPEView* WPEContextThread::createWPEView(GstWpeVideoSrc* src, GstGLContext* cont WPEView* view = nullptr; dispatch([&]() mutable { - auto* manager = webkit_website_data_manager_new_ephemeral(); - auto web_context = webkit_web_context_new_with_website_data_manager(manager); - g_object_unref(manager); - - view = new WPEView(web_context, src, context, display, width, height); + if (!glib.web_context) { + auto *manager = webkit_website_data_manager_new_ephemeral(); + glib.web_context = + webkit_web_context_new_with_website_data_manager(manager); + g_object_unref(manager); + } + view = new WPEView(glib.web_context, src, context, display, width, height); }); if (view && view->hasUri()) { -- 2.7.4