Skip to content

Stream chooser fixups#492

Open
soreau wants to merge 3 commits into
masterfrom
stream-chooser-fixups
Open

Stream chooser fixups#492
soreau wants to merge 3 commits into
masterfrom
stream-chooser-fixups

Conversation

@soreau

@soreau soreau commented Jun 21, 2026

Copy link
Copy Markdown
Member

No description provided.

@soreau
soreau force-pushed the stream-chooser-fixups branch from 7b94b32 to f29ef2e Compare June 22, 2026 04:38
@trigg

trigg commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Updated to latest wayfire & copy-capture.

Running up 10 maximized terminals on wf-stream-chooser master, no problem.

With this PR it invokes OOM killer which somehow always chooses Wayfire.

@soreau

soreau commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

Can you try this patch to see if it makes a difference?

diff --git a/src/stream-chooser/outputwidget.cpp b/src/stream-chooser/outputwidget.cpp
index 306809e..a34f926 100644
--- a/src/stream-chooser/outputwidget.cpp
+++ b/src/stream-chooser/outputwidget.cpp
@@ -23,25 +23,17 @@ static void frame_handle_presentation_time(void*,
 {}
 
 static void frame_handle_ready(void *data,
-    struct ext_image_copy_capture_frame_v1 *frame)
+    struct ext_image_copy_capture_frame_v1*)
 {
     WayfireChooserOutput *output = (WayfireChooserOutput*)data;
 
     output->buffer_ready();
-
-    ext_image_copy_capture_frame_v1_destroy(frame);
-    output->frame = nullptr;
 }
 
-static void frame_handle_failed(void *data,
-    struct ext_image_copy_capture_frame_v1 *frame,
+static void frame_handle_failed(void*,
+    struct ext_image_copy_capture_frame_v1*,
     uint32_t reason)
-{
-    WayfireChooserOutput *output = (WayfireChooserOutput*)data;
-
-    ext_image_copy_capture_frame_v1_destroy(frame);
-    output->frame = nullptr;
-}
+{}
 
 static const struct ext_image_copy_capture_frame_v1_listener frame_listener = {
     .transform = frame_handle_transform,
diff --git a/src/stream-chooser/toplevelwidget.cpp b/src/stream-chooser/toplevelwidget.cpp
index 380744e..deec9ad 100644
--- a/src/stream-chooser/toplevelwidget.cpp
+++ b/src/stream-chooser/toplevelwidget.cpp
@@ -123,25 +123,17 @@ static void frame_handle_presentation_time(void*,
 {}
 
 static void frame_handle_ready(void *data,
-    struct ext_image_copy_capture_frame_v1 *frame)
+    struct ext_image_copy_capture_frame_v1*)
 {
     WayfireChooserTopLevel *toplevel = (WayfireChooserTopLevel*)data;
 
     toplevel->buffer_ready();
-
-    ext_image_copy_capture_frame_v1_destroy(frame);
-    toplevel->frame = nullptr;
 }
 
-static void frame_handle_failed(void *data,
-    struct ext_image_copy_capture_frame_v1 *frame,
+static void frame_handle_failed(void*,
+    struct ext_image_copy_capture_frame_v1*,
     uint32_t reason)
-{
-    WayfireChooserTopLevel *toplevel = (WayfireChooserTopLevel*)data;
-
-    ext_image_copy_capture_frame_v1_destroy(frame);
-    toplevel->frame = nullptr;
-}
+{}
 
 static const struct ext_image_copy_capture_frame_v1_listener frame_listener = {
     .transform = frame_handle_transform,

@trigg

trigg commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

With that patch I get thrown back to login when I have too many terminals open

wf-stream-choos[24679]: segfault at 40 ip 00007f5911bee1c4 sp 00007fffd6a6d3f8 error 4 in libwayland-client.so.0.25.0[51c4,7f5911bec000+7000] likely on CPU 15 (core 7, socket 0)

No crash but clearly struggling without this PR.

Will attempt to catch a log this time

@trigg

trigg commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator
Thread 1 "wayfire" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff729a163 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:89
#2  0x00007ffff723e5d0 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff7225685 in __GI_abort () at abort.c:77
#4  0x00007ffff7226704 in __libc_message_impl (vma_name=vma_name@entry=0x7ffff73b6908 "glibc: assert", fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:138
#5  0x00007ffff72361f2 in __libc_message_wrapper (vmaname=0x7ffff73b6908 "glibc: assert", fmt=<optimized out>) at ../include/stdio.h:203
#6  __assert_fail (assertion=assertion@entry=0x7ffff7e85578 "wl_list_empty(&backend->events.new_input.listener_list)", file=file@entry=0x7ffff7e79e92 "backend/backend.c", line=line@entry=51, function=function@entry=0x7ffff7eb1ca0 <__PRETTY_FUNCTION__.1.lto_priv.19> "wlr_backend_finish") at assert.c:37
#7  0x00007ffff7dc4d3d in wlr_backend_finish (backend=0x555555774fa0) at ../wlroots0.20/backend/backend.c:51
#8  0x00007ffff7e0b3a4 in multi_backend_destroy (wlr_backend=0x555555774fa0) at ../wlroots0.20/backend/multi/backend.c:52
#9  0x00007ffff7efb590 in wl_signal_emit_mutable (signal=signal@entry=0x55555578d320, data=data@entry=0x55555578d310) at ../wayland-1.25.0/src/wayland-server.c:2396
#10 0x00007ffff7deb5a0 in wlr_backend_finish (backend=backend@entry=0x55555578d310) at ../wlroots0.20/backend/backend.c:48
#11 0x00007ffff7df4672 in backend_destroy (backend=0x55555578d310) at ../wlroots0.20/backend/drm/backend.c:47
#12 0x00007ffff7dfba79 in handle_drm_event (fd=<optimized out>, mask=<optimized out>, data=0x55555578d310) at ../wlroots0.20/backend/drm/drm.c:2099
#13 handle_drm_event (fd=<optimized out>, mask=<optimized out>, data=0x55555578d310) at ../wlroots0.20/backend/drm/drm.c:2089
#14 0x00007ffff7efd3d2 in wl_event_loop_dispatch (loop=0x5555557751b0, timeout=<optimized out>, timeout@entry=-1) at ../wayland-1.25.0/src/event-loop.c:1059
#15 0x00007ffff7eff567 in wl_display_run (display=0x5555557750c0) at ../wayland-1.25.0/src/wayland-server.c:1593
#16 0x00005555555e3bce in main ()

So, specifically with stream-chooser from this PR.

It appears to happen sometimes when a window is added (Using Meta+T to open a terminal in my case)

Although I'm not seeing the 'how' here

@soreau

soreau commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

This seems very similar to the issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants