Click here to Skip to main content
15,910,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:34
Jader8925-Oct-05 7:34 
QuestionRe: Malloc / Free problem Pin
David Crow25-Oct-05 9:27
David Crow25-Oct-05 9:27 
AnswerRe: Malloc / Free problem Pin
Jader8925-Oct-05 9:34
Jader8925-Oct-05 9:34 
AnswerRe: Malloc / Free problem Pin
Jader8925-Oct-05 9:39
Jader8925-Oct-05 9:39 
GeneralRe: Malloc / Free problem Pin
David Crow25-Oct-05 9:47
David Crow25-Oct-05 9:47 
QuestionRe: Malloc / Free problem Pin
Jader8925-Oct-05 11:00
Jader8925-Oct-05 11:00 
AnswerRe: Malloc / Free problem Pin
David Crow25-Oct-05 11:07
David Crow25-Oct-05 11:07 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 11:20
Jader8925-Oct-05 11:20 
The queue:
std::queue<GUIQueue*> GUIQ;

the struct:
struct GUIQueue<br />
{<br />
	bool isBmp;<br />
	int size;<br />
	char* data;<br />
};


other than that, i just imported the queue.h header file,
and used the methods push(), and front(), since pop doesnt really do anything
other than completely remove the front of the queue.

here is the failing code as one thread, also note, that without the push, and pop, the free()'s worked fine.:

GUIQueue* newMsg = (GUIQueue*)malloc( sizeof(GUIQueue) );<br />
memset( newMsg, 0, sizeof(GUIQueue) );<br />
newMsg->data = (char*)malloc( sizeof(msg.u.reqvid) );<br />
memcpy( newMsg->data, &msg, sizeof(msg.u.reqvid) + sizeof( MsgHeader ) );<br />
newMsg->size = sizeof(msg.u.reqvid) + sizeof(MsgHeader);<br />
newMsg->isBmp = true;<br />
GUIQ.push( newMsg );<br />
<br />
GUIQueue* test = (GUIQueue*)GUIQ.front();<br />
GUIQ.pop();<br />
if( test->data != NULL )<br />
{<br />
	free(test->data);<br />
	test->data = NULL;<br />
}<br />
if( test != NULL )<br />
{<br />
	free(test);<br />
	test = NULL;<br />
}




"There are 10 types of people, those who understand binary, and those who don't."
- Somebody, not me.
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 11:30
Jader8925-Oct-05 11:30 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 12:25
Jader8925-Oct-05 12:25 
AnswerRe: Malloc / Free problem Pin
Maximilien25-Oct-05 7:34
Maximilien25-Oct-05 7:34 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:45
Jader8925-Oct-05 7:45 
AnswerRe: Malloc / Free problem Pin
Jader8925-Oct-05 7:58
Jader8925-Oct-05 7:58 
GeneralRe: Malloc / Free problem Pin
Jader8925-Oct-05 8:15
Jader8925-Oct-05 8:15 
QuestionNew notification code for subclassed CButton Pin
Roger Stoltz25-Oct-05 6:28
Roger Stoltz25-Oct-05 6:28 
AnswerRe: New notification code for subclassed CButton Pin
willy_total25-Oct-05 6:57
willy_total25-Oct-05 6:57 
GeneralRe: New notification code for subclassed CButton Pin
Roger Stoltz25-Oct-05 7:08
Roger Stoltz25-Oct-05 7:08 
Questionhow to obtain file permision (rwx) from web host? Pin
includeh1025-Oct-05 6:01
includeh1025-Oct-05 6:01 
QuestionRe: how to obtain file permision (rwx) from web host? Pin
David Crow25-Oct-05 7:30
David Crow25-Oct-05 7:30 
AnswerRe: how to obtain file permision (rwx) from web host? Pin
includeh1026-Oct-05 0:29
includeh1026-Oct-05 0:29 
QuestionRe: how to obtain file permision (rwx) from web host? Pin
David Crow26-Oct-05 2:47
David Crow26-Oct-05 2:47 
QuestionUsing a hook and hidden objects in windows. Pin
Maddo25-Oct-05 5:43
Maddo25-Oct-05 5:43 
QuestionVector mapping issue Pin
itkid25-Oct-05 5:13
itkid25-Oct-05 5:13 
Questionstrange behavior ... anybody knows ? Pin
FreeClimber25-Oct-05 4:42
FreeClimber25-Oct-05 4:42 
QuestionThanks for all your help + new help Pin
Tom Moore25-Oct-05 4:32
Tom Moore25-Oct-05 4:32 

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.