Skip to content

Commit

Permalink
Fix a few things on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Dec 20, 2023
1 parent 65404da commit db7d4ef
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ vst = { git = "https://github.com/helgoboss/vst-rs.git", branch = "feature/param
#reaper-fluent = { path = "../reaper-rs/main/fluent" }
#reaper-high = { path = "../reaper-rs/main/high" }
#reaper-medium = { path = "../reaper-rs/main/medium" }
#reaper-macros = { path = "../reaper-rs/main/macros" }
#reaper-low = { path = "../reaper-rs/main/low" }
#reaper-rx = { path = "../reaper-rs/main/rx" }
#rppxml-parser = { path = "../reaper-rs/main/rppxml-parser" }
Expand Down
10 changes: 9 additions & 1 deletion main/src/infrastructure/plugin/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1699,7 +1699,15 @@ impl Drop for App {
fn drop(&mut self) {
self.message_panel.close();
self.party_is_over_subject.next(());
let _ = unregister_api();
// This is ugly but we need it on Windows where getting the current thread can lead to
// "use of std::thread::current() is not possible after the thread's local data has been destroyed"
// when exiting REAPER. The following code essentially ignores this.
let old_panic_hook = std::panic::take_hook();
std::panic::set_hook(Box::new(|_| {}));
let _ = std::panic::catch_unwind(|| {
let _ = unregister_api();
});
std::panic::set_hook(old_panic_hook);
}
}

Expand Down
7 changes: 3 additions & 4 deletions main/src/infrastructure/plugin/realearn_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use base::{
use helgoboss_allocator::*;
use lazycell::LazyCell;
use reaper_high::{Reaper, ReaperGuard};
use reaper_low::{reaper_vst_plugin, static_vst_plugin_context, PluginContext};
use reaper_low::{static_vst_plugin_context, PluginContext};
use reaper_medium::{Hz, ReaperStr};

use slog::{debug, o};
Expand Down Expand Up @@ -56,9 +56,8 @@ const NORMAL_REAL_TIME_TO_MAIN_TASK_QUEUE_SIZE: usize = 10_000;
const CONTROL_MAIN_TASK_QUEUE_SIZE: usize = 5000;
const PARAMETER_MAIN_TASK_QUEUE_SIZE: usize = 5000;

reaper_vst_plugin!();

/// A REAPER-extension-like entry point, *in addition* to the VST entry point.
/// Generates a REAPER-extension-like entry point. It also generates everything that
/// `reaper_vst_plugin!` macro would generate, so we don't need that anymore.
///
/// This needs some explanation: No, we are not a REAPER extension! This extension entry point will
/// not be called by REAPER (because our shared library is located in the "UserPlugins/FX"
Expand Down

0 comments on commit db7d4ef

Please sign in to comment.