Scopedpointer lost?

Dear All

There is something that makes my app crashing, and I do not understand the cause.
I'm using introjucer to create my UI, my app is as follow:

In MainContent, I have one object VelocityCurvesClass, which is the content of a tabbedComponent

MainContent::MainContent ()
{
    addAndMakeVisible (tabbedComponent = new TabbedComponent (TabbedButtonBar::TabsAtTop));
    ….
    tabbedComponent->addTab (TRANS("  Velocity Curves  "), Colours::lightgrey, new VelocityCurvesClass(), true);
    ….
}

The above VelocityCurveClass is declared as follow:


class VelocityCurvesClass  : public Component,
                             public ButtonListener,
                             public ComboBoxListener
{
public:
    void initDefautlUi();
….
private:

    ScopedPointer<OnOffCurveDragComponent> curveCursorImgView;
}


VelocityCurvesClass::VelocityCurvesClass ()
{

    addAndMakeVisible (curveCursorImgView = new OnOffCurveDragComponent());

    curveCursorImgView->initToDefault();
    initDefautlUi();
}

void VelocityCurvesClass::initDefautlUi()
{
    anotherFunction(0x10);
}

void VelocityCurvesClass::anotherFunction(int val)
{
  curveCursorImgView->onoffCurveValue = val;   <<<< ERROR HERE: EXC_BAD_ACCESS
}

I've created one introjucer component called OnOffCurveDragComponent, which is used in the above VelocityCurveClass.

class OnOffCurveDragComponent  : public Component
{
public:
    int onoffCurveValue;

    void initToDefault();
}


void OnOffCurveDragComponent::initToDefault()
{
    onoffCurveValue = 127;
}

In the above code, we can see introjucer created the object curveCursorImgView, which is an object of class OnOffCurveDragComponent.
In the constructor above, I added curveCursorImgView->initToDefault(), this works fine.

Then a call to initDefautlUi(); is done from the constructor too.
This initDefautlUi() calls another function called anotherFunction(), and in this function, the public member of curveCursorImgView is set, but this makes my app crashing.

When setting a breakpoint on anotherFunction(), it seems the object curveCursorImgView is lost (it is not null but with an address 0x54 which seems weird).

Any suggestion or tip would be greatly appreciated.
Thanks!

I found the issue.
The scope pointer was an object containing an array declared as int myArray[32].
That seemed to cause a lot of issues, I now replaced int myArray[32] with Array<int> myArray; and it seems everything works as expected...
J