Bug in VST3 Wrapper


#1

I've found a bug that's driven on a line (shown below) of the VST3 wrapper.  It's possible for  juce::attachComponentToWindowRef (component, parent, isNSView) to be called with a null component pointer.  This in turn causes a crash. I can drive this from Cubase 7.5.3 (Mac) by clicking the AlwaysOnTop widget (upper right hand corner) of the plugin window (this is the wrapper window provided by Cubase).

It's not enough simply to guard against the null pointer at this level.  Doing so causes a blank draw of the plugin GUI.  Any ideas?

Edit: It occurred to me after the original post that the line number might be off, since I've got some diagnostic stuff in the file.  Here's the problem area. The actual crash is in the mm file.

        tresult PLUGIN_API attached (void* parent, FIDString type) override
        {
            if (parent == nullptr || isPlatformTypeSupported (type) == kResultFalse)
                return kResultFalse;

           #if JUCE_WINDOWS
            component->addToDesktop (0, parent);
            component->setOpaque (true);
            component->setVisible (true);
           #else
            isNSView = (strcmp (type, kPlatformTypeNSView) == 0);
            macHostWindow = juce::attachComponentToWindowRef (component, parent, isNSView);
           #endif
            component->resizeHostWindow();
            systemWindow = parent;
            attachedToParent();
            return kResultTrue;
        }

#2

Hmm. My guess is that it should be fixed by creating a component if it's not there, like this:

        tresult PLUGIN_API attached (void* parent, FIDString type) override
        {
            if (parent == nullptr || isPlatformTypeSupported (type) == kResultFalse)
                return kResultFalse;

            if (component == nullptr)
                component = new ContentWrapperComponent (*this, pluginInstance);

..but I've not tested it - could you double-check that this sorts out the problem that you're seeing there?


#3

Thanks Jules!  That fixes the crash problem.  But now that it's fixed, I'm afraid another problem has been exposed.  As soon as I make a parameter adjustment, its value snaps to zero.  If I hold the knob with the mouse it will stay where I'm holding it (behaves appropriately).  But as soon as I release the button, the value is immediately driven to zero--almost as if it's automated. I haven't played with other VST3 hosts yet, so I don't know if this is peculiar to Cubase or not.

When I run a VST2.4 version (built at the same time), behavior is normal and as expected.  


#4

The snap-to-zero is likely due to the ParameterChangeGesture problem I reported back in April:

http://www.juce.com/forum/topic/vst3-parameterchangegesture-problem-cubase-75

The only workaround I'm aware of it to conditionally remove begin/end ParameterChangeGesture support for the VST3 build, unless Jules or someone else has come up with a better solution.


#5

Thanks for posting that, Frank.  I'm sorry it's taken so long to reply.  You appear to be correct, and the conditional compile appears to take care of the problem.  But I now find that 64-bit VST crashes in the plugin scanner for Nuendo and Cubase.  The crash itself appears to be in the Steinberg plugin manager, and probably happens after the scan is done.  To me that hints that the wrapper is doing something that leaves the system unstable.  Of course I can't run Cubase or VST under the debugger, so this is likely to be a bear to get sorted out.

 

NOTE: Might be something else going on.  Back when I know more...

... and now I know more. 

The crash came from using Xcode 6.0.1.  There were no obvious error messages from the build, and no problems with AAX or AU.  But there's clearly something in this version of Xcode and 64-bit VST (VST2.4 and VST3) that don't get along. I supposed I'll have to get an understanding of that someday, but for now I'm happily back on Xcode 5.1.1


#6

From VST Mailing list Thread [vst-plugins] Re: Mac: VST3PluginTestHost, Cubase and Nuendo crash on launch

 

And I found a workaround: Set "Link with Standard Libraries" to NO and add to "Link Binary with Libraries" the "libSystem.dylib" and "libc++.dylib". At least that works for me. cheers arne On 11 Oct 2014, at 15:13, Stefan Huber <s_huber@gmx.net> wrote:

Arne, thanks a lot for checking this. Glad I am not the only one seeing this.. Best regards, Stefan Sent from mobile.

On 11.10.2014, at 14:47, Arne Scheffler <scheffle-vst@knup.de> wrote: Hi, it looks like Xcode 6.0.1 has a bug as I'm seeing the same here. That an AU host is not crashing is because they never unload unused bundles. And the bug only triggers if a bundle is unloaded. Time to file a bug @ Apple. cheers arne