Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-9599

QTextEdit component crashes when you press the "delete" key

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.6.3
    • 4.6.2
    • GUI: Text handling
    • 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

      { -> priv->remove(pos1, pos2-pos1, op); adjusted_anchor = anchor = position; priv->finishEdit(); }

      after executing the "priv->remove(pos1, pos2-pos1, op);" method
      the "this" pointer points to something filled with 0xfeeefeee (windows HeapFree).

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            stawel Pawel Stawicki
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes