-1
내지도 :: 삽입 방법이 나에게 유용한 정보를 많이주지 않고 깨고있다.map :: insert is breaking.
typedef map<wstring, int> IndexLookupMap;
static IndexLookupMap indexLookup;
static vector<LPDIRECT3DTEXTURE9> textures;
extern "C" void EXPORT_API LoadTexture(const wchar_t* file, int* index, unsigned char* data) {
wstring key(file);
if(indexLookup.size() > 0)
{
IndexLookupMap::iterator it = indexLookup.find(key);
if(it == indexLookup.end())
{
//not found, load it
LPDIRECT3DTEXTURE9 pTexture;
D3DXCreateTextureFromFile(g_D3D9Device, file, &pTexture);
textures.push_back(pTexture);
*index = textures.size() - 1;
D3DLOCKED_RECT locked;
pTexture->LockRect(0, &locked, NULL, 0);
data = reinterpret_cast<unsigned char*>(locked.pBits);
pTexture->UnlockRect(0);
indexLookup.insert(IndexLookupMap::value_type(key, *index));
}
else
{
//found, get it
*index = it->second;
textures.at(*index);
}
}
else
{
//not found, load it
LPDIRECT3DTEXTURE9 pTexture;
D3DXCreateTextureFromFile(g_D3D9Device, file, &pTexture);
textures.push_back(pTexture);
*index = textures.size() - 1;
D3DLOCKED_RECT locked;
pTexture->LockRect(0, &locked, NULL, 0);
data = reinterpret_cast<unsigned char*>(locked.pBits);
pTexture->UnlockRect(0);
indexLookup.insert(IndexLookupMap::value_type(key, *index)); //breaks here
}
}
그것은에 위반된다
indexLookup.insert(IndexLookupMap::value_type(key, *index));
실제 휴식 xtree에서 발생
나는 당신의map
되기 전에
LoadTexture
가 호출되는 것으로 의심 제공하는 최소한의 정보를 바탕으로
_Nodeptr _Trynode = _Root();
"파괴적"이란 무엇을 의미합니까? –
Unity3D에서 플러그인으로 실행하고 있는데, 깨지는 것은 프로그램 충돌/종료입니다. –
@StormKiernan : 먼저 코드를 게시하기 전에 문제를 격리하기 위해 디버깅을 먼저 수행하십시오. –