I have a pointer to the card that I am trying to delete (this map was highlighted new).
This card is valid, I think when I find it during debugging, it shows pMap : [0]() ..
When I try to delete this blank card, my application just shuts down and I get
First chance exception in 0xsomelocation in myapp.exe: 0xsomenumber: the called object disconnected from its clients.
in the output window. What does it mean?
Thanks..
EDIT: Here is a sample code:
typedef map<const char*, StructA*, StructB> myMap; typedef vector<myMap *> myMapStack;
StructB has an overloaded operator () Edit: StructB IS really a structure, sorry, operator () is just a string comparison function.
In some part of my code, the class constructor calls a method, let it call InitClass (), which initializes the myMap pointer as follows:
pMyMap = new myMap; // I also tried this with new myMap() // this pointer is then pushed onto the a map stack pMyMapStack.push_back(pMyMap);
Later in the destructor of this class I go
pMyMap = pMyMapStack.back(); pMyMapStack.pop_back(); delete pMyMap; // after I step over this line the app quits.. and displays that message
thanks
EDIT: I went back to an older version of the code that worked, and now it works fine.
What worked was something like this:
// after the pMyMapStack.pop_back() int x = pMyMap->size(); if (x >= 0) delete pMyMap;
I used to change it to this:
// after the pMyMapStack.pop_back() int (x = pMyMap->size(); if (x >= 0){ pMyMap->clear(); delete pMyMap; }
Strange .. There might be something else wrong with the code, but I just can't figure out where else .. It's too big (and I probably would have fired it) if I had posted the whole code, so let me just leave it at the same time.
I think it could be a pointer to a null card that I was trying to clear or delete, which caused problems.
Thanks to everyone who tried to help ... :)