Closed raygit83 closed 1 year ago
Here's a minimal example:
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;
}
};
Will be fixed with the next SDK update.
Okay, that's great news. Out of curiosity: Any hints on how you fixed this? Can I review the respective commit somewhere? Thanks.
See here: https://forums.steinberg.net/t/crash-in-auv2-wrapper-using-vst3-sdk-v3-7-7/838542