From c568e5d3be28dec31cc7c9ea7be690917c522a75 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 28 Mar 2022 00:50:08 +0200 Subject: [PATCH] Don't wait for the request resize result We'll need to find a workaround for this, but this makes resizing in the CLAP example host way too slow. --- src/wrapper/clap/context.rs | 10 ++++++++-- src/wrapper/clap/wrapper.rs | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/wrapper/clap/context.rs b/src/wrapper/clap/context.rs index 0841c580..3ac7dad9 100644 --- a/src/wrapper/clap/context.rs +++ b/src/wrapper/clap/context.rs @@ -30,7 +30,7 @@ impl GuiContext for WrapperGuiContext

{ fn request_resize(&self) -> bool { // Bitwig and the CLAP test host require this resize to be done from the main thread, so // we'll use a channel as a substitute for a promise here. - let (result_sender, result_receiver) = channel::bounded(1); + let (result_sender, _result_receiver) = channel::bounded(1); if !self .wrapper .do_maybe_async(Task::RequestResize(result_sender)) @@ -39,7 +39,13 @@ impl GuiContext for WrapperGuiContext

{ return false; } - result_receiver.recv().expect("Main thread died?") + // FIXME: Waiting for this can be very slow when this function gets called many times in + // rapid succession because the X11 GUI thread is not the same as the host's GUI + // thread and both Bitwig and CLAP will reject (or outright SIGABRT) if this gets + // called from any other thread + // result_receiver.recv().expect("Main thread died?") + + true } // All of these functions are supposed to be called from the main thread, so we'll put some diff --git a/src/wrapper/clap/wrapper.rs b/src/wrapper/clap/wrapper.rs index de4be3b8..09bca8e2 100644 --- a/src/wrapper/clap/wrapper.rs +++ b/src/wrapper/clap/wrapper.rs @@ -324,7 +324,7 @@ impl MainThreadExecutor for Wrapper

{ }; // This channel acts as a promise, there will never be more than a single value - // writen to it. + // writen to it, and if the other end got dropped then that's okay let _ = result_sender.send(result); } };