0

私はVisual Studio 2012 Express Invalid addressを非常に単純なコードでキャプチャしようとしていますが、どうすればキャプチャできますか。これは、コードを実行しようとしたときに得られるものです:

HEAP[match2_new.win32.exe]: Invalid address specified to RtlValidateHeap( 002C0000, 02E43AA8 )
match2_new.win32.exe has triggered a breakpoint.

これはスタックです:

    msvcr110d.dll!_CrtIsValidHeapPointer(const void * pUserData) Line 2036  C++
    msvcr110d.dll!_free_dbg_nolock(void * pUserData, int nBlockUse) Line 1322   C++
    msvcr110d.dll!_free_dbg(void * pUserData, int nBlockUse) Line 1265  C++
    msvcr110d.dll!operator delete(void * pUserData) Line 54 C++
    match2_new.win32.exe!std::allocator<std::_Container_proxy>::deallocate(std::_Container_proxy * _Ptr, unsigned int __formal) Line 586    C++
    match2_new.win32.exe!std::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >::_Free_proxy() Line 683 C++
    match2_new.win32.exe!std::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >::~_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >() Line 656  C++
    match2_new.win32.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >() Line 965  C++
>   match2_new.win32.exe!GameController::setGemsInBoard(int levlnumber) Line 98 C++
    match2_new.win32.exe!GameLayer::startGame() Line 53 C++
    match2_new.win32.exe!GameScene::init() Line 43  C++
    match2_new.win32.exe!GameScene::create() Line 24    C++
    match2_new.win32.exe!GameScene::scene() Line 19 C++
    match2_new.win32.exe!AppDelegate::applicationDidFinishLaunching() Line 109  C++
    libcocos2d.dll!cocos2d::CCApplication::run() Line 47    C++
    match2_new.win32.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 34  C++
    match2_new.win32.exe!__tmainCRTStartup() Line 528   C
    match2_new.win32.exe!wWinMainCRTStartup() Line 377  C

簡単なコード:

void GameController::setGemsInBoard(int levlnumber)
{

    switch (levlnumber)
    {
    case 1:
         {
             std::string level_1 = "00011000,00111100,01111110,01111110,01111110,01111110,00111100,00011000";
           fillBoardArray(level_1);
             break;
         }
    case 2:
         {
             std::string level_2 = "00011000,00011000,11111111,11111111,11111111,00111100,00011000,00011000";
             fillBoardArray(level_2);
             break;
         }
    default:
        break;
    }


}

更新:

void fillBoardArray(std::string lvlstr);


void GameController::fillBoardArray(std::string lvlstr)
{
   // CCLOG("fillBoardArray");
    int irow=0;
    int icol=0;
    for(int i=0;i<lvlstr.size();i++)
    {
        if(lvlstr[i]=='0')
        {
            m_GemBoardPositionMap[irow][icol] = 0;
            icol++;
        }
        else if(lvlstr[i]=='1')
        {
            m_GemBoardPositionMap[irow][icol] = 1;
            icol++;
        }
        else if(lvlstr[i]==',')
        {
            irow++;
            icol=0;
        }
    }


}
4

0 に答える 0