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

Memory leak caused by the content menu of QLineEdit, QTextEdit, QMessageBox, ...

XMLWordPrintable

    • I4c2c3edb3f63ce914b7b57cd0fbcec20488c8315

      Hello,

      I had report a similar issue: https://bugreports.qt.nokia.com/browse/QTBUG-19592

      But this problem seems more serious than I had thought.

      The contextmenu of QTextEdit/QPlainTextEdit/QLineEdit/QLabel etc all have the save memory leak.

      follow code can be used to reproduce the issue:

      #include <QtWidgets>
      
      class Widget:public QLineEdit
      {
      public:
          Widget(const QString &t){
              this->setText(t);
          }
      protected:
          void mouseDoubleClickEvent(QMouseEvent *){
              this->dumpObjectTree();
          }
      };
      
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          Widget w("Right clicked on me several times, Then double clicked me");
          w.show();
          return a.exec();
      }
      
      

      or

      #include <QtWidgets>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QMessageBox msgBox;
          msgBox.setDetailedText("Right clicked on Me several times, then close me ... ");
          msgBox.exec();
          msgBox.dumpObjectTree();
      
          return a.exec();
      }
      

      And I had figure out that: the problem is caused by the solution which used to fix https://bugreports.qt.nokia.com/browse/QTBUG-7902

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

            frederik Frederik Gladhorn
            dbzhang800 debao zhang
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes