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.
Bookmarks