Thread: Weird Acception Violation :: MFC

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348

    Weird Acception Violation :: MFC

    Hi.

    I have discovered a major bug in a simple program. The problem has a propertysheet. There are two pages the are almost exactly the same. Both pages have a CListCtrl box. In both pages, the user can add items, select items, and/or remove existing items.

    For some reason, only one page worked in the *release* version of the program. Everything worked perfect in debug mode, but one page crashed in release. The page that crashed does so in the same manner every time. Below is a logs of the crash.

    // debug log

    -----
    // this occurs AFTER the user options a propertysheet
    // program does NOT crash at this point

    First-chance exception at 0x7196254a in myProgram: 0xC0000005: Access violation writing location 0x00463b2c.

    // this occurs when the user selects an item in a CListCtrl box
    // program crashes at this point

    First-chance exception at 0x046936d7 in myProgram: 0xC0000005: Access violation reading location 0x046936d7.

    Unhandled exception at 0x046936d7 in myProgram: 0xC0000005: Access violation reading location 0x046936d7.

    The program '[1120] myProgram: Native' has exited with code 128 (0x80).
    -----

    I have no idea how to fix this problem. I have compared the two property pages I mentioned that have the CListCtrl boxes. The code in both property pages are flawless.

    First, I thought the program crashed because there was a code program in the function that determines what item is selected in the CListCtrl box. However, I have found that the program does not crash at all inside that function. It crashed sometime after leaving the function.

    Is this a memory problem? Please post if you have any idea on debugging this problem.

    Thanks,
    Kuphryn
    Last edited by kuphryn; 07-15-2002 at 01:35 PM.

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Okay. I have found the problem.

    The problem has to do with the way I was determining the state of an item in a CListCtrl. I had to change the algorithm. Now the program no longer crashes.

    MFC does some really weird stuff in the background. Be careful or you might end up with many problems.

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Weird access violation error with stack
    By ryeguy in forum C++ Programming
    Replies: 2
    Last Post: 02-29-2008, 02:53 AM
  2. reading file weird access violation
    By p3p in forum C++ Programming
    Replies: 6
    Last Post: 09-03-2005, 08:06 AM
  3. MFC :: WM_SIZE message causes access violation?
    By SyntaxBubble in forum Windows Programming
    Replies: 1
    Last Post: 06-09-2003, 10:01 AM
  4. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM
  5. Beginning MFC (Prosise) Part III - Now What? :: C++
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 03-03-2002, 06:58 PM