Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VST2 in reaper: Vitalium Crash on close/reopen #109

Open
nidefawl opened this issue May 12, 2022 · 2 comments
Open

VST2 in reaper: Vitalium Crash on close/reopen #109

nidefawl opened this issue May 12, 2022 · 2 comments

Comments

@nidefawl
Copy link

nidefawl commented May 12, 2022

When reopening or sometimes even when having Vitalium in the background I get a segfault.
I get the same crash inside my own DAW project. Apparently, after the window is closed, (or before it is fully opened?!) it keeps processing something on the event queue related to the parent window the VST2 implementation is passing to the plugin.
It always crashes here (inside dynamic_cast):

if (auto* peer = dynamic_cast<LinuxComponentPeer*> (getPeerFor (event.xany.window)))

I tested the LV2 version on Reaper, and it doesn't seem to be affected.

Here is a workaround I came up with:

diff --git a/libs/juce-current/source/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp b/libs/juce-current/source/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp
index 55e2bf2d..e9d37966 100644
--- a/libs/juce-current/source/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp
+++ b/libs/juce-current/source/modules/juce_gui_basics/native/x11/juce_linux_XWindowSystem.cpp
@@ -1388,7 +1388,9 @@ ComponentPeer* getPeerFor (::Window windowH)
     if (auto* display = XWindowSystem::getInstance()->getDisplay())
     {
         XWindowSystemUtilities::ScopedXLock xLock;
-        X11Symbols::getInstance()->xFindContext (display, (XID) windowH, windowHandleXContext, &peer);
+        if (!X11Symbols::getInstance()->xFindContext (display, (XID) windowH, windowHandleXContext, &peer))
+            if (peer != nullptr && ! ComponentPeer::isValidPeer (reinterpret_cast<LinuxComponentPeer*> (peer)))
+                peer = nullptr;
     }
 
     return unalignedPointerCast<ComponentPeer*> (peer);
@@ -2822,7 +2824,7 @@ void XWindowSystem::setWindowType (::Window windowH, int styleFlags) const
         std::vector<Atom> netStateHints;
 
         addAtomIfExists ((styleFlags & ComponentPeer::windowAppearsOnTaskbar) == 0, "_NET_WM_STATE_SKIP_TASKBAR", display, netStateHints);
-        addAtomIfExists (getPeerFor (windowH)->getComponent().isAlwaysOnTop(),      "_NET_WM_STATE_ABOVE",        display, netStateHints);
+        // addAtomIfExists (getPeerFor (windowH)->getComponent().isAlwaysOnTop(),      "_NET_WM_STATE_ABOVE",        display, netStateHints);
 
         auto numHints = (int) netStateHints.size();
 

BTW: I got crashes from the latest official Vital VST2 linux build at the very same location, so I think this workaround would help upstream as well.

@nidefawl
Copy link
Author

Oh, it seems like this was fixed before, but deemed no longer necessary. 🤨

@CameronAsselin
Copy link

Having the same issue with the VST3 on Arch in Reaper.

The LV2 kept changing settings on a close/reopen and the VST3 fixed that, but eventually crashed Reaper and wont re-open the project file without crashing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants