Hi, sorry to trouble you again guys. Ok, this one is not a false alarm, I think.
The problem occurs when I want to pass a vector of LPCWSTR's (null-terminated wide strings) to a DLL. After I finished using the vector, it would crash with ........ error dialog:
This may be due to a corruption of the heap, which indicates a bug in photobooth.exe or any of the DLLs it has loaded.
the code:
Code:
std::vector<LPCWSTR> m_vPlaylist; //BAWE-20100301: NEW_VIDEOPLAYER. Used in to VideoPlayer (attractmovie.dll) .
Code:
bool InitLayer::createAttractWindow(
SystemAccess* pSystemAccess,
HMONITOR hMonitor
) {
...
// AttractWindow is a class from another DLL so in this case I passed the vector of LPCWSTR to another dll.
m_pAttractWindow = AttractWindow::createInstance(
hInstance,
hMonitor,
m_vPlaylist //BAWE-20100301: NEW_VIDEOPLAYER. Crash!!!
);
...
}
Code:
AttractWindow* AttractWindow::createInstance( HINSTANCE hInstance, HMONITOR hMonitor, std::vector<LPCWSTR> vPlaylist )
{
...
m_pVideoPlayer = new VideoPlayer( hWnd, true );
m_pAttractWindow = new AttractWindow(
hInstance,
hWnd,
pVideoPlayer
);
m_pAttractWindow->init( vPlaylist );
...
return m_pAttractWindow;
}
void AttractWindow::init(std::vector<LPCWSTR> vPlaylist) {
std::vector<LPCWSTR>::iterator iterPlaylist = vPlaylist.begin();
while (iterPlaylist != vPlaylist.end() )
{
m_pVideoPlayer->AddMovie( *iterPlaylist );
++ iterPlaylist;
}
}
I've stepped through "AttractWindow::init" and it worked fine. But after I get to the last line of "AttractWindow::createInstance" (the "return m_pAttractWindow" line), it crashed. Why did this happen? Thanks in advance.