Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.6.2
-
None
-
Windows XP 64bit, debug mode (deterministic), release mode (not deterministic)
-
d32a818ecb2e707e548f2ad7a5222062db7edf32
Description
when I use a class which looks like this:
class MyTextEdit : public QTextEdit { void onTextChanged() { QTextCursor copyOfCurrentCursor = textCursor(); //<- this line is the problem QTextCharFormat f; setCurrentCharFormat(f); // this is also needed to replicate crash } MyTextEdit() { connect(this,SIGNAL(textChanged()),this,SLOT(onTextChanged())); } };
I get a crash (when the "delete" key is pressed inside the QTextEdit).
The problem is the "copyOfCurrentCursor";
The destructor deletes the QTextCursorPrivate instance;
when I set a breakpoint in qtextcursor.cpp line 172:
void QTextCursorPrivate::remove()
.
.
} else
after executing the "priv->remove(pos1, pos2-pos1, op);" method
the "this" pointer points to something filled with 0xfeeefeee (windows HeapFree).