I've been messing around with the stepper tool in the chunks example of WDL-ol. I've made it so the number of steps displayed is dynamically adjustable. Fine.
But when the destructor runs (closing the plugin) I get an error about trying to delete an unallocated pointer. I don't understand why because I am testing for nulls before deleting.
this is the significant part of the constructor:
Code:
{
...
float sliderWidth = ((float) mDrawRECT.W() / (float) mStepsDisplayed);
mSteps = new double[numSliders];
for(int i=0; i<numSliders; i++)
{
mSteps[i] = 0.;
}
for(int i=0; i<mStepsDisplayed; i++)
{
int lpos = (i * sliderWidth);
mSteps[i] = 1.;
mSliderBounds[i] = new IRECT(mDrawRECT.L + lpos , mDrawRECT.T, mDrawRECT.L + lpos + sliderWidth, mDrawRECT.B);
}
mHandleWidth = handleWidth;
}
...
and this is the destructor:
Code:
~MultiSliderControlV()
{
delete [] mSteps;
for(int i=0; i<mNumSliders; i++)
{
if (mSliderBounds[i] != NULL)
{
delete mSliderBounds[i];
}
}
}