Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unhandled win32 Exception: Access Violation Reading Location
Forum Update on Monday, May 27th 2025

Unhandled win32 Exception: Access Violation Reading Location

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 3.3k Views
  • 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.
  • B Offline
    B Offline
    BrawnyLad
    wrote on 31 Jul 2012, 19:52 last edited by
    #1

    I made trivial changes. Now I face an unhandled exception immediately upon the start of a run, even though I am pretty sure I restored everything to the original.

    It appears that the problem occurs at
    @
    void * __cdecl _malloc_base (size_t size)
    ...
    res = _heap_alloc(size);
    @

    When I build I get two warnings:
    "getenv may be unsafe" and "vc100.pdb missing"

    Running in debug I get
    “The inferior stopped because it triggered an exception. Read access violation at :0x0, flags 0x0."

    In the disassembler:
    "0x65396efa <+0x004a> mov ecx,dword ptr [ebx+124h]"

    Any suggestions would be welcomed! I'm stuck!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jeroentjehome
      wrote on 1 Aug 2012, 08:34 last edited by
      #2

      Hi there,
      First of all the use of malloc is not really a C++ way to go if you ask me. Using the "new" to allocate memory is much more OS independent.
      A couple of questions to ask your self in the code:

      • Did the malloc get the memory requested? (when the system is busy it might even not give you the requested memory)
      • When using the pointer does it point to anything (a NULL returned if the malloc failed).
        Given the warning of the debugger (Read acces violation at 0x0) you probably have a NULL pointer that is used to read or write data with. The OS protects against read/write operations outside the heap and stack of the program.
        Hope this helps, but I would suggest using "new" and "delete" for the memory allocation.
        Greetz

      Greetz, Jeroen

      1 Reply Last reply
      0

      1/2

      31 Jul 2012, 19:52

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved