mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Fix rare X11 error on editor closing
With the new deferred closing behaviour, closing the editor of Vital's VST2 version would trigger an X11 error in Wine's X11drv. This doesn't seem to happen with other plugins (or the VST3 version of Vital) and the fact that this workaround even works is strange to say the least, but at least it does work.
This commit is contained in:
@@ -242,16 +242,26 @@ Editor::Editor(const Configuration& config, const size_t parent_window_handle)
|
||||
}
|
||||
|
||||
Editor::~Editor() {
|
||||
// Wine will wait for the parent window to properly delete the window during
|
||||
// `DestroyWindow()`. Instead of implementing this behavior ourselves we
|
||||
// just reparent the window back to the window root and let the WM handle
|
||||
// it.
|
||||
// Reparent the window back to the root window, as the actual window will be
|
||||
// destroyed as part of the next Win32 message loop cycle
|
||||
xcb_window_t root =
|
||||
xcb_setup_roots_iterator(xcb_get_setup(x11_connection.get()))
|
||||
.data->root;
|
||||
|
||||
xcb_reparent_window(x11_connection.get(), wine_window, root, 0, 0);
|
||||
xcb_flush(x11_connection.get());
|
||||
|
||||
// XXX: I'm pretty sure this is a Wine bug (or, well, an unfortunate
|
||||
// interaction of Wine's behaviour and our embedding). If we don't
|
||||
// explicitly hide the window before sending a `WM_CLOSE` (in
|
||||
// `destroy_window_async()`), then we might get an X11 error because
|
||||
// the closing of the window will trigger an X11 event in Wine's X11drv
|
||||
// which then tries to interact with the no longer existing window.
|
||||
// Manually hiding the window seems to work around this.
|
||||
// TODO: Check if we also have to do something special for
|
||||
// editor_double_embed (probalby not)
|
||||
// TODO: Retest XEmbed after all of these changes
|
||||
ShowWindow(win32_handle.get(), SW_HIDE);
|
||||
}
|
||||
|
||||
HWND Editor::get_win32_handle() const {
|
||||
|
||||
Reference in New Issue
Block a user