A
Angus
Hello
I am doing this in a worker thread:
char* szPartial = new char[strlen(szBuffer)+1];
if (szPartial)
{
lstrcpy(szPartial, szBuffer);
PostMessage(m_thishWnd, WM_USER+1, 0, (LPARAM)szPartial);
}
PostMessage is platofrm dependent but it is not particulalry relevant
to this problem. It is just a mechanism to pass a message to another
thread in Windows.
In the thread passed to, I do this:
// [lParam is the variable name of the dxPartial passed].
char* sz = reinterpret_cast<char*>(lParam);
std::string str = sz;
delete [] sz;
Get an assert on the delete [] sz; - debug msg is:
DAMAGE: after Normal block (#56) at 0x008C4570
But why? What am I doing wrong?
I am doing this in a worker thread:
char* szPartial = new char[strlen(szBuffer)+1];
if (szPartial)
{
lstrcpy(szPartial, szBuffer);
PostMessage(m_thishWnd, WM_USER+1, 0, (LPARAM)szPartial);
}
PostMessage is platofrm dependent but it is not particulalry relevant
to this problem. It is just a mechanism to pass a message to another
thread in Windows.
In the thread passed to, I do this:
// [lParam is the variable name of the dxPartial passed].
char* sz = reinterpret_cast<char*>(lParam);
std::string str = sz;
delete [] sz;
Get an assert on the delete [] sz; - debug msg is:
DAMAGE: after Normal block (#56) at 0x008C4570
But why? What am I doing wrong?