I have the following code:
data.m_pWndOrganizerProgressDlg = this;
data.m_pWndImageOrganizerDlg = m_pWndImageOrganizerDlg;
UINT COrganizerProgressDlg::RunBackgroundWorker(LPVOID pParam)
// Run organizer engine
COrganizerEngine engine(m_nNotifyMessage, (CWorkerData*)pParam);
catch (CException *e)
data is an object with automatic storage duration. Once it goes out of scope, it is no longer valid. I'm assuming, that
data goes out of scope before the worker thread gets a chance to pick up the information.
To solve this there are essentially 2 options:
newto allocate a
CWorkerDatainstance and pass the address to the worker thread. The worker thread can then call
delete, whenever its done with the object.