Click here to Skip to main content
15,924,452 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralStartup Pin
Peter Liddle6-Nov-01 11:30
Peter Liddle6-Nov-01 11:30 
GeneralRe: Startup Pin
Ravi Bhavnani6-Nov-01 11:42
professionalRavi Bhavnani6-Nov-01 11:42 
GeneralRe: Startup Pin
Anders Molin6-Nov-01 11:46
professionalAnders Molin6-Nov-01 11:46 
GeneralRe: Startup Pin
Ravi Bhavnani6-Nov-01 12:02
professionalRavi Bhavnani6-Nov-01 12:02 
GeneralRe: Startup Pin
Christian Graus6-Nov-01 11:44
protectorChristian Graus6-Nov-01 11:44 
GeneralRe: Startup Pin
Nish Nishant6-Nov-01 21:33
sitebuilderNish Nishant6-Nov-01 21:33 
GeneralDisappearing Act Pin
Stephen Caldwell6-Nov-01 11:29
Stephen Caldwell6-Nov-01 11:29 
GeneralReappearing Act Pin
Alvaro Mendez6-Nov-01 12:17
Alvaro Mendez6-Nov-01 12:17 
Well, I do notice a very possible cause of the problem. Your first Push function creates "newelem" on the stack and then sets "pLast" to point to it. When the function returns, "newelem" is no longer valid (since the stack is cleaned) and "pLast" is left pointing to garbage.

The way to fix it is to allocate newelem on the heap, like this:

void fsConfigObject::Push(set_element Elem)
{	
  fsCOElem* newelem = new fsCOElem;	
  newelem->pNext = pLast;	
  newelem->seData = Elem;	
  pLast = newelem;
}


But then you need to remember to call delete to free this memory. (At times like these I see the value of Java/VB/C#. Smile | :) ) You can do it in the destructor:

fsConfigObject::~fsConfigObject()
{
  fsCOElem* pCur = pLast;	
  while(pCur)	
  {
     fsCOElem* pDelete = pCur;
     pCur = pCur->pNext;	
     delete pDelete;
  }
}


Regards,
Alvaro
QuestionCombobox list height? Pin
clintsinger6-Nov-01 11:03
clintsinger6-Nov-01 11:03 
AnswerRe: Combobox list height? Pin
Joaquín M López Muñoz6-Nov-01 12:35
Joaquín M López Muñoz6-Nov-01 12:35 
GeneralRe: Combobox list height? Pin
clintsinger6-Nov-01 18:40
clintsinger6-Nov-01 18:40 
GeneralRe: Combobox list height? Pin
Joaquín M López Muñoz6-Nov-01 19:57
Joaquín M López Muñoz6-Nov-01 19:57 
GeneralRe: Combobox list height? Pin
clintsinger7-Nov-01 6:03
clintsinger7-Nov-01 6:03 
GeneralFrom one ListBox to another Pin
Monica6-Nov-01 10:54
Monica6-Nov-01 10:54 
GeneralRe: From one ListBox to another Pin
Ravi Bhavnani6-Nov-01 11:03
professionalRavi Bhavnani6-Nov-01 11:03 
GeneralListBoxes and the magic of VKeyToItem() Pin
Andrew Stampor6-Nov-01 10:50
Andrew Stampor6-Nov-01 10:50 
GeneralRe: ListBoxes and the magic of VKeyToItem() Pin
Ravi Bhavnani6-Nov-01 11:15
professionalRavi Bhavnani6-Nov-01 11:15 
GeneralRe: ListBoxes and the magic of VKeyToItem() Pin
Andrew Stampor6-Nov-01 11:26
Andrew Stampor6-Nov-01 11:26 
GeneralSetCapture hell Pin
Christian Graus6-Nov-01 10:41
protectorChristian Graus6-Nov-01 10:41 
GeneralRe: SetCapture hell Pin
Andrew Peace6-Nov-01 13:27
Andrew Peace6-Nov-01 13:27 
GeneralRe: SetCapture hell Pin
Jon Hulatt6-Nov-01 22:16
Jon Hulatt6-Nov-01 22:16 
Generalbrowser Pin
6-Nov-01 9:45
suss6-Nov-01 9:45 
General#include "everything.h" Pin
Jamie Hale6-Nov-01 9:18
Jamie Hale6-Nov-01 9:18 
GeneralRe: #include "everything.h" Pin
PJ Arends6-Nov-01 9:31
professionalPJ Arends6-Nov-01 9:31 
GeneralRe: #include "everything.h" Pin
Jamie Hale6-Nov-01 9:36
Jamie Hale6-Nov-01 9:36 

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.