Results 1 to 7 of 7

Thread: QTextEdit::keyPressEvent leads to 0xC0000005 Access Violation Error

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2009
    Posts
    13
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Lightbulb QTextEdit::keyPressEvent leads to 0xC0000005 Access Violation Error

    I'm really stuck on this one, so i'll explain the situation and hopefully one of the professional programmers here will easily detect the error.

    I recently updates from Qt4.4 to Qt4.6. The code was not changed, worked before but now leads to an error in debug.

    I defined a custom TextEdit class with parent QTextEdit. This class has an overloaded keyPressEvent-function, which checks for a few keys and otherwise calls the parent keyPressEvent with: QTextEdit::keyPressEvent(event);
    I build the program, run it, and if i typed in something everything worked fine.
    However after the update there is an Access Violation Error apearing while executing this line.
    The error appears in the file free.c, line 109: retval = HeapFree(_crtheap, 0, pBlock);
    It only appears when the Backspace-Key or the Delete-Key are pressed, maybe on other keys which i haven't found yet. And it fails not everytime, but around 90%. If i type in letters or use the tab it works fine.

    If i remove the line in which the parent function is called there is no error (and no QTextEdit::keyPressEvent(event) called). If i remove the overloaded function completely so only the QTextEdit::keyPressEvent(event) is called the error still appears.

    My thought was that the keyPressEvent may be called multiple times and that is conflicting with the memory, but that is not the case. the keyPressEvent is only called once, in this line. The problem appears independant on the computer it's executed on. Maybe someone knows what i could have done wrong, or if it's just a Qt bug with the version update. I looked through the Changelist for QTextEdit but didn't find anything useful which has changed the way a keyPressEvent is used.
    Last edited by android_; 12th March 2010 at 12:09.

Similar Threads

  1. OpenCV causes access violation only during timerEvent
    By derekkingston in forum Qt Programming
    Replies: 5
    Last Post: 19th February 2010, 08:56
  2. Replies: 5
    Last Post: 17th June 2009, 14:01
  3. Access violation when reading big text files
    By robertson1 in forum General Programming
    Replies: 0
    Last Post: 18th September 2008, 06:59
  4. Access Violation on Signal Emit
    By khagzan in forum Qt Programming
    Replies: 2
    Last Post: 25th September 2007, 22:51
  5. 0xc0000005 when linking against lib
    By niko in forum Qt Programming
    Replies: 10
    Last Post: 8th March 2006, 08:55

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.