Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. dlete pointer.

dlete pointer.

Scheduled Pinned Locked Moved C / C++ / MFC
question
23 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Viorel

    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.

    S Offline
    S Offline
    see me
    wrote on last edited by
    #21

    Thank you... I don't know it will work or not. Let me check. yours faithfully ajeeshcv

    1 Reply Last reply
    0
    • S see me

      The pointer is of a dialog. Initialization: CMyDialog* pMyDialog; pMyDialog = new CMyDialog; pMyDialog->EndDialog(0); if(pMyDialog) { delete pMyDialog; pMyDialog = 0; } yours faithfully ajeeshcv

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #22

      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


      1 Reply Last reply
      0
      • S see me

        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

        J Offline
        J Offline
        jhwurmbach
        wrote on last edited by
        #23

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups