Crash in AUv2 Wrapper using VST3 SDK v3.7.7

Hi Arne,

Here’s a minimal example. Tested with the latest SDK (applying the necessary patches to the AUWrapper in lines 2584…) on an MBP M1 2020 running Ventura 13.2.1 and the latest GarageBand version.

Everything works fine on arm64, but the crash occurs once you run in Rosetta2 mode. The same has been reported for intel machines:

        class AGainEditor : public VSTGUIEditor, public IControlListener
        {
        enum
        {
            kWidth = 400,
            kHeight = 400,
            kButton1 = 'btn1',
            kButton2 = 'btn2'
        };
            
        public:
            AGainEditor (void* controller) :
                VSTGUIEditor(controller)
            {
                ViewRect vr(0, 0, kWidth, kHeight);
                setRect(vr);
            }
            
            virtual ~AGainEditor () {}
            
            virtual bool PLUGIN_API open (void* parent, const VSTGUI::PlatformType& platformType) SMTG_OVERRIDE
            {
                auto r = getRect();
                CRect size(r.left, r.top, r.right, r.bottom);
                
                auto oldFrame = frame;
                frame = new CFrame(size, this);
                if(oldFrame)
                    oldFrame->forget();
                
                if(frame->open(parent, platformType))
                {
                    frame->setBackgroundColor(kBlueCColor);
                    
                    CRect buttonSize(0, 0, 120, 20);
                    
                    buttonSize.centerInside(size);
                    buttonSize.offset(CPoint(-buttonSize.getWidth() / 2 - 2, 0));
                    auto button1 = new CTextButton(buttonSize, this, kButton1, "zoomFactor = 1", CTextButton::Style::kKickStyle);
                    frame->addView(button1);
                    
                    buttonSize.centerInside(size);
                    buttonSize.offset(CPoint(+buttonSize.getWidth() / 2 + 2, 0));
                    auto button2 = new CTextButton(buttonSize, this, kButton2, "zoomFactor = 2");
                    frame->addView(button2);
                    
                    return true;
                }
                
                return false;
            }
            
            virtual void PLUGIN_API close () SMTG_OVERRIDE
            {
                if(frame)
                {
                    frame->close();
                    frame = nullptr;
                }
            }
            
            virtual void valueChanged (CControl* pControl) SMTG_OVERRIDE
            {
                int tag = pControl->getTag();
                float value = pControl->getValue();
                if(value > 0.5f)
                {
                    if(tag == kButton1)
                    {
                        frame->setZoom(1.0);
                    }
                    
                    else if(tag == kButton2)
                    {
                        frame->setZoom(2.0);
                    }
                }
            }
            
            bool beforeSizeChange(const CRect& newSize, const CRect& oldSize) SMTG_OVERRIDE
            {
                static bool resizeGuard = false;
                bool result = resizeGuard;

                if(plugFrame && !result)
                {
                    resizeGuard = true;
                    ViewRect vr;
                    vr.right = int32(newSize.getWidth());
                    vr.bottom = int32(newSize.getHeight());
                    result = (plugFrame->resizeView(this, &vr) == kResultTrue);
                    resizeGuard = false;
                }

                return result;
            }
        };

Calling plugFrame->resizeView(this, &vr) will end up in the aforementioned endless recursion in the AUCocoaView implementation where inst.callSuper<void (NSRect)>... calls the class’ own function instead of the super class’ one.

Note that the problem goes away once I use the older AUCocoaView implementation which doesn’t rely on the ObjCClassBuilder, perhaps that helps.

Here’s a different bug that has been recently reported after updating to the VST3 SDK 3.7: The editor is flipped vertically on macOS (AU?) when running in Live 9. This hasn’t been the case with older SDK versions. I don’t have access to Live 9 but perhaps you wanna look into it too at some point.

Best,
Ray