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

Mac style leaks memory with indicators

    XMLWordPrintable

Details

    • macOS
    • 38cf346bd70de6aaabfbf66ba159919591ce9098

    Description

      Attached application seems to be leaking memory as it increases constantly. When forcing Fusion style instead, it stays at 7MB, but with mac style memory use constantly increases.

      #include <QApplication>
      #include <QStyle>
      #include <QPainter>
      #include <QImage>
      #include <QStyleOption>
      #include <qgraphicsview.h>
      #include <qgraphicsscene.h>
      #include <QGraphicsWidget>
      #include <QRadioButton>
      #include <QTimer>
      #include <QDebug>
      class W : public QGraphicsWidget{
          void paint(QPainter* p, const QStyleOptionGraphicsItem* option, QWidget*){
              QStyleOptionButton opt;
              opt.rect=option->rect;
              opt.state=QStyle::State_On|QStyle::State_Enabled;
              for (int i = 0; i < 20; ++i)
                  qApp->style()->drawControl(QStyle::CE_RadioButton, &opt, p);
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QGraphicsView view(new QGraphicsScene);
          auto radio = new W;
          view.scene()->addItem(radio);
          view.show();
          QTimer t;
          t.start(1);
          QObject::connect(&t, &QTimer::timeout, [radio](){
              radio->update();
          });
          a.exec();
      }
      

      Attachments

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

        Activity

          People

            tpochep Timur Pocheptsov
            poikelin Joni Poikelin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes