dangling pointer-bugs fixing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mark Antony
    New Member
    • Feb 2008
    • 2

    #1

    dangling pointer-bugs fixing

    Hi,
    I find very difficult to fix the dangling pointer bug occurred in my new open source office application developed in C++ language. I need some information to resolve this bug?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    That is because they are very hard bugs to find and fix.

    I would suggest

    1. If you are using pointers when you delete the data the pointed to set the pointers value back to NULL. This way rather than getting data corruption you will (hopefully get NULL pointer exceptions that you can find and fix)

    or

    2. Rather than pointers use handles, handles are smart pointers that only delete the data once everyone has finished using it Handle Classes: The Smart Pointer

    Comment

    Working...