forked from 1b-agent/opencadstudio-upstream
fix(plugin): f64 pick coords + harden out-of-process lifecycle
Follow-ups after merging the out-of-process plugin isolation work: - Convert the out-of-process interactive adapter's `on_point` / `on_entity_pick` to `glam::DVec3`, matching the `CadCommand` trait, which moved to f64 pick coordinates. The branch predated that change and no longer compiled against the trait. - Contain plugin constructor panics in `export_plugin!`: the constructor runs across the C ABI boundary in `ocs_plugin_register`, where an unwinding panic is undefined behavior. Catch it and return null, which the loader already treats as a failed registration. - Reap killed runner processes. The spawn-timeout and disconnect paths called `child.kill()` without `wait()`, leaving a zombie on Unix until the host exited. Route both — and `shutdown()` — through a shared `reap()` that kills and waits on a detached thread. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
deec2a8fd3
commit
b4093724f2
4 files changed
+220
-18
No files matched your search
@@ -333,13 +333,13 @@ impl crate::command::CadCommand for PluginProcessInteractiveAdapter {
|
||||
fn prompt(&self) -> String {
|
||||
self.prompt.clone().unwrap_or_default()
|
||||
}
|
||||
fn on_point(&mut self, pt: glam::Vec3) -> crate::command::CmdResult {
|
||||
fn on_point(&mut self, pt: glam::DVec3) -> crate::command::CmdResult {
|
||||
use ocs_plugin_api::ipc::protocol::InteractiveEvent;
|
||||
let result = self
|
||||
.process
|
||||
.interactive_event(
|
||||
self.command_id,
|
||||
InteractiveEvent::Point([pt.x as f64, pt.y as f64, pt.z as f64]),
|
||||
InteractiveEvent::Point([pt.x, pt.y, pt.z]),
|
||||
)
|
||||
.map(plugin_step_to_result)
|
||||
.unwrap_or(crate::command::CmdResult::Cancel);
|
||||
@@ -359,7 +359,7 @@ impl crate::command::CadCommand for PluginProcessInteractiveAdapter {
|
||||
fn needs_entity_pick(&self) -> bool {
|
||||
self.needs_entity_pick.unwrap_or(false)
|
||||
}
|
||||
fn on_entity_pick(&mut self, handle: Handle, pt: glam::Vec3) -> crate::command::CmdResult {
|
||||
fn on_entity_pick(&mut self, handle: Handle, pt: glam::DVec3) -> crate::command::CmdResult {
|
||||
use ocs_plugin_api::ipc::protocol::InteractiveEvent;
|
||||
let result = self
|
||||
.process
|
||||
@@ -367,7 +367,7 @@ impl crate::command::CadCommand for PluginProcessInteractiveAdapter {
|
||||
self.command_id,
|
||||
InteractiveEvent::ObjectPick {
|
||||
handle,
|
||||
pt: [pt.x as f64, pt.y as f64, pt.z as f64],
|
||||
pt: [pt.x, pt.y, pt.z],
|
||||
},
|
||||
)
|
||||
.map(plugin_step_to_result)
|
||||
|
||||
Reference in new issue
Block a user