Click here to Skip to main content
15,904,416 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: cube class Pin
Christian Graus15-Jun-07 22:00
protectorChristian Graus15-Jun-07 22:00 
JokeRe: cube class Pin
Cedric Moonen16-Jun-07 0:10
Cedric Moonen16-Jun-07 0:10 
GeneralRe: cube class Pin
Kevin McFarlane16-Jun-07 0:59
Kevin McFarlane16-Jun-07 0:59 
JokeRe: cube class Pin
Hamid_RT16-Jun-07 9:18
Hamid_RT16-Jun-07 9:18 
AnswerRe: cube class Pin
Hamid_RT16-Jun-07 9:19
Hamid_RT16-Jun-07 9:19 
QuestionDestroy the memory Pin
Anu_Bala15-Jun-07 20:18
Anu_Bala15-Jun-07 20:18 
AnswerRe: Destroy the memory Pin
Mark Salsbery16-Jun-07 6:55
Mark Salsbery16-Jun-07 6:55 
Questiondelete this within the class function causing problems Pin
Cyrilix15-Jun-07 18:17
Cyrilix15-Jun-07 18:17 
The code below will cause a heap error:

Error: HEAP[Core.exe]: Invalid Address specified to RtlFreeHeap( 00510000, 01CB45C8 )

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	ThreadPool* pThreadPool = 0;

	//Initialize thread handler
	pThreadPool = ThreadHandlerEntry();

	//Signal thread handler termination and wait for worker thread termination before freeing resources
	pThreadPool->Release();

	return 0;
}


Inside pThreadPool->Release(), delete this is called, and that's where it fails. If I change the code to the below, where delete this has been taken out of pThreadPool->Release() and replaced with delete pThreadPool in WinMain(), it works.

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	ThreadPool* pThreadPool = 0;

	//Initialize thread handler
	pThreadPool = ThreadHandlerEntry();

	//Signal thread handler termination and wait for worker thread termination before freeing resources
	pThreadPool->Release();
        delete pThreadPool;

	return 0;
}


Anyone know why this is?
GeneralRe: delete this within the class function causing problems Pin
Matthew Faithfull16-Jun-07 0:18
Matthew Faithfull16-Jun-07 0:18 
GeneralRe: delete this within the class function causing problems Pin
Cyrilix16-Jun-07 5:08
Cyrilix16-Jun-07 5:08 
AnswerRe: delete this within the class function causing problems Pin
Matthew Faithfull16-Jun-07 5:24
Matthew Faithfull16-Jun-07 5:24 
GeneralRe: delete this within the class function causing problems Pin
Cyrilix16-Jun-07 6:06
Cyrilix16-Jun-07 6:06 
AnswerRe: delete this within the class function causing problems Pin
Stephen Hewitt17-Jun-07 12:55
Stephen Hewitt17-Jun-07 12:55 
GeneralRe: delete this within the class function causing problems Pin
Cyrilix17-Jun-07 17:18
Cyrilix17-Jun-07 17:18 
QuestionCreate Standart Animation With V C++ Pin
san_sui15-Jun-07 17:08
san_sui15-Jun-07 17:08 
AnswerRe: Create Standart Animation With V C++ Pin
Hamid_RT15-Jun-07 19:02
Hamid_RT15-Jun-07 19:02 
Questionerror c3409 [modified] Pin
moonraker92815-Jun-07 12:53
moonraker92815-Jun-07 12:53 
AnswerRe: error c3409 Pin
David Crow15-Jun-07 15:58
David Crow15-Jun-07 15:58 
GeneralRe: error c3409 [modified] Pin
moonraker92815-Jun-07 17:09
moonraker92815-Jun-07 17:09 
GeneralRe: error c3409 Pin
David Crow16-Jun-07 15:42
David Crow16-Jun-07 15:42 
QuestionHelp with conversion to VC* - Linker error Pin
b644715-Jun-07 12:31
b644715-Jun-07 12:31 
AnswerRe: Help with conversion to VC* - Linker error Pin
kvrnkiran19-Jun-07 0:02
kvrnkiran19-Jun-07 0:02 
GeneralRe: Help with conversion to VC* - Linker error Pin
b644719-Jun-07 13:51
b644719-Jun-07 13:51 
Questionhaving a class be a member of itself Pin
moonraker92815-Jun-07 12:27
moonraker92815-Jun-07 12:27 
AnswerRe: having a class be a member of itself Pin
markkuk15-Jun-07 12:46
markkuk15-Jun-07 12:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.