From ba54a360583ba84ea13d2a2ba16bf8d82f5bc80c Mon Sep 17 00:00:00 2001 From: Rafostar <40623528+Rafostar@users.noreply.github.com> Date: Tue, 3 Nov 2020 17:18:37 +0100 Subject: [PATCH] Keep a ref to main context Might help with GJS toggling down object bug. Needs some testing. --- clapper_src/playerBase.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/clapper_src/playerBase.js b/clapper_src/playerBase.js index dd17da45..8d7834ed 100644 --- a/clapper_src/playerBase.js +++ b/clapper_src/playerBase.js @@ -1,4 +1,4 @@ -const { Gio, GObject, Gst, GstPlayer, Gtk } = imports.gi; +const { Gio, GLib, GObject, Gst, GstPlayer, Gtk } = imports.gi; const Debug = imports.clapper_src.debug; let { debug } = Debug; @@ -24,7 +24,13 @@ class ClapperPlayerBase extends GstPlayer.Player let glsinkbin = Gst.ElementFactory.make('glsinkbin', null); glsinkbin.sink = gtkglsink; - let dispatcher = new GstPlayer.PlayerGMainContextSignalDispatcher(); + let context = GLib.MainContext.ref_thread_default(); + let acquired = context.acquire(); + debug(`default context acquired: ${acquired}`); + + let dispatcher = new GstPlayer.PlayerGMainContextSignalDispatcher({ + application_context: context, + }); let renderer = new GstPlayer.PlayerVideoOverlayVideoRenderer({ video_sink: glsinkbin });