guix_mirror_bot pushed a commit to branch master
in repository guix.

commit b1845efdbe07485f45aed55fc8bd810a8c3f9d2f
Author: Ghislain Vaillant <[email protected]>
AuthorDate: Sun Nov 8 20:47:41 2026 +0100

    gnu: pitivi: Cherry-pick upstream patch fixing a race condition.
    
    * gnu/packages/patches/pitivi-fix-preview-video-sink.patch: New file.
    * gnu/packages/video.scm (pitivi)[source]<patches>: Add it.
    
    Merges: https://codeberg.org/guix/guix/pulls/12407
    Signed-off-by: Nguyễn Gia Phong <[email protected]>
---
 .../patches/pitivi-fix-preview-video-sink.patch    | 55 ++++++++++++++++++++++
 gnu/packages/video.scm                             |  5 +-
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/patches/pitivi-fix-preview-video-sink.patch 
b/gnu/packages/patches/pitivi-fix-preview-video-sink.patch
new file mode 100644
index 00000000000..dc96a6b2ae7
--- /dev/null
+++ b/gnu/packages/patches/pitivi-fix-preview-video-sink.patch
@@ -0,0 +1,55 @@
+From 52cb30ae78e8322fc4055b1f064ec86427fd5a9c Mon Sep 17 00:00:00 2001
+From: Thibault Saunier <[email protected]>
+Date: Mon, 3 Mar 2025 09:03:41 -0300
+Subject: [PATCH] viewer: Fix a race where gtksink is started before being
+ embedded in the UI
+
+Which was leading to g_warning and an external Gtk window to pop up.
+
+We now set the preview video sink only once it has already
+been embedded in our widget avoiding that possible issue
+---
+ pitivi/utils/pipeline.py | 4 ----
+ pitivi/viewer/viewer.py  | 4 +++-
+ 2 files changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
+index d85055665..39fa9b4cf 100644
+--- a/pitivi/utils/pipeline.py
++++ b/pitivi/utils/pipeline.py
+@@ -563,10 +563,6 @@ def __init__(self, app):
+                 watchdog.props.timeout = WATCHDOG_TIMEOUT * 1000
+                 self.props.audio_filter = watchdog
+ 
+-    def create_sink(self):
+-        video_sink, sink_widget = SimplePipeline.create_sink(self)
+-        self._pipeline.preview_set_video_sink(video_sink)
+-        return video_sink, sink_widget
+ 
+     def set_mode(self, mode):
+         self._next_seek = None
+diff --git a/pitivi/viewer/viewer.py b/pitivi/viewer/viewer.py
+index 0ea7a183e..010ad1693 100644
+--- a/pitivi/viewer/viewer.py
++++ b/pitivi/viewer/viewer.py
+@@ -175,10 +175,10 @@ def set_project(self, project):
+         project.connect("audio-channels-changed", 
self._project_audio_channels_changed_cb)
+ 
+     def __create_new_viewer(self):
+-        _, sink_widget = self.project.pipeline.create_sink()
+ 
+         self.guidelines_popover = GuidelinesPopover()
+         self.guidelines_button.set_popover(self.guidelines_popover)
++        video_sink, sink_widget = self.project.pipeline.create_sink()
+         self.overlay_stack = OverlayStack(self.app,
+                                           sink_widget,
+                                           self.guidelines_popover.overlay)
+@@ -194,6 +194,8 @@ def __create_new_viewer(self):
+ 
+         self.viewer_row_box.show_all()
+ 
++        self.project.pipeline.preview_set_video_sink(video_sink)
++
+         # Wait for 1s to make sure that the viewer has completely realized
+         # and then we can mark the resize status as showable.
+         GLib.timeout_add(1000, self.__viewer_realization_done_cb, None)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index d3384b86bfc..b4249521648 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -6203,7 +6203,10 @@ tools for styling them, including a built-in real-time 
video preview.")
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "12sbl9dlw9rh44mbyfx6pzan4jkhcxidrcbfqih10cyyv50cqjkb"))))
+        (base32 "12sbl9dlw9rh44mbyfx6pzan4jkhcxidrcbfqih10cyyv50cqjkb"))
+       (patches
+        ;; Cherry-picked upstream, to be removed in next release.
+        (search-patches "pitivi-fix-preview-video-sink.patch"))))
     (build-system meson-build-system)
     (native-inputs
      (list gettext-minimal

Reply via email to