diff --git a/CHANGELOG.md b/CHANGELOG.md index b182475d..15d940e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,8 @@ Versioning](https://semver.org/spec/v2.0.0.html). If you try to process audio from the...audio thread, then they will produce silence and hang afterwards (which a fix in yabridge 3.7.0 previously addressed). +- Fixed crashes when opening plugin editors under **Crostini** on ChromeOS due + to non-standard X11 implementations. - Worked around a bug in the _RandARP_ VST2 plugin where the plugin would report that its editor window is 0 by 0 pixels. - Fixed building under (the currently upcoming) Wine 7.2 because of definition diff --git a/src/wine-host/editor.cpp b/src/wine-host/editor.cpp index 9b7de9ef..1e745654 100644 --- a/src/wine-host/editor.cpp +++ b/src/wine-host/editor.cpp @@ -839,10 +839,18 @@ void Editor::set_input_focus(bool grab) const { // we don't just check whether `current_focus` and `focus_target` are the // same window but we'll also allow `current_focus` to be a child of // `focus_target`. + // NOTE: To make matters even more complicated, the focused window can also + // be `None` or `PoointerRoot`. In a normal Xorg setup this will never + // happen, but apparently Crostini does some strange things and it can + // happen there. Since those flags aren't valid windows, we must avoid + // calling `is_child_window_or_same()` in those cases. + // https://github.com/robbert-vdh/yabridge/issues/167 const xcb_window_t current_focus = focus_reply->focus; if (current_focus == focus_target || - (grab && is_child_window_or_same(*x11_connection_, current_focus, - focus_target))) { + (grab && current_focus != XCB_INPUT_FOCUS_NONE && + current_focus != XCB_INPUT_FOCUS_POINTER_ROOT && + is_child_window_or_same(*x11_connection_, current_focus, + focus_target))) { logger_.log_editor_trace([&]() { std::string reason = "unknown reason"; if (current_focus == focus_target) {