dlete pointer.
-
I think this causes problems if your project’s configuration does not allow multi-threading. You should open the project’s properties dialog and be sure that the C/C++ --> Code Generation --> Runtime Library option contains a right value related to multi-threading. Then rebuild the application.
-
The pointer is of a dialog. Initialization: CMyDialog* pMyDialog; pMyDialog = new CMyDialog; pMyDialog->EndDialog(0); if(pMyDialog) { delete pMyDialog; pMyDialog = 0; } yours faithfully ajeeshcv
im not sure your problem is this but how to create dialog? and if you run your code i think you get a error in pMyDialog->EndDialog(0); now try this and send me if you have a error
CMyDialog* pMyDialog; pMyDialog = new CMyDialog; pMyDialog->Create(IDD_TEST);//id from dialog pMyDialog->EndDialog(0); delete pMyDialog ; pMyDialog = 0;
_**
**_
whitesky
-
ok... I think the problem is occuring due to this reason. am initializing the pointer from thread...adn try to delete it from another thread.. if there is any chance of occuring exception???? Please help me... yours faithfully ajeeshcv
Ajeesh c v wrote:
am initializing the pointer from thread...adn try to delete it from another thread
May one thread still be accessing the memory you just deleted? Maybe using smart-pointers (like those from boost.org)[^]can help you? Or at least an object which can delete itself via a member function?
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.