Failing while trying to add a new object to a vector

Failing while trying to add a new object to a vector
0.0 0


I’m not sure why it’s doing this, it should be working but according to the engine it fails while trying to add a new object to a vector that I’ve made.

All I’m doing before it fails is one time through my for loop.

    for(int i = 0; i < 15; i++)
        GameSpot* newSpot = new GameSpot(i+1);

Not sure but it seems to be failing when it’s pushing back on the vector. This is all that’s happening before the second loop. All “GameSpot(i+1)” is doing is putting a number in the object’s variable.

When it fails at the bottom of Xcode it says “GDB: Program received signal:”EXC_BAD_ACCESS“”.

Anyone able to point me in the right direction? I’m at a loss here. I can give any more information that’s needed.


What’s m_vSpots and GameSpot look like?
It seems that the codes is nothing about engine, it is just some normal c++ codes.


All m_vSpots is, is…

    vector m_vSpots;

GameSpot looks like…

class GameSpot
    GamePiece* m_gpPiece;
    int m_nSpotIndex;
    vector m_vJumpSpots;
    vector m_vAdjacentSpots;

    void SetSpotIndex(int nSpotIndex) { m_nSpotIndex = nSpotIndex; }

    GameSpot(int nSpotIndex);

GameSpot::GameSpot(int nSpotIndex)
    m_gpPiece = NULL;

I’m just not sure why it’s failing when I finish adding to the vector after the first time in the loop.


Any ideas? I’m seriously at a loss. I don’t understand why it’s failing as soon as I try to push_back onto the vector.