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

QObject::dumpObjectInfo might segfault

    XMLWordPrintable

Details

    • 6a664d0660911173c7e85c60b9af195a0ef4f110 (qt/qtbase/dev) c6b6bb5653691125a6e17287077be7d81c919369 (qt/qtbase/6.0) 56db78a77519494a795d0139973c7776d56fffd3 (qt/tqtc-qtbase/tqtc/lts-5.15)

    Description

      This program segfaults:

      #include <QObject>
      #include <QDebug>
      
      class IntHolder : public QObject {
          Q_OBJECT
      
      private:
          int value_;
      public:
          IntHolder() : QObject() {}
          int value() const { return value_; }
          void setValue(int v) { value_ = v; emit valueChanged(value_); }
      signals:
          void valueChanged(int);
      public slots:
          void changeValue(int v) {
              setValue(v);
          };
      };
      
      int main(){
          IntHolder* a = new IntHolder;
          IntHolder* b = new IntHolder;
          QObject::connect(a, SIGNAL(valueChanged(int)), b, SLOT(changeValue(int)));
      
          a->setValue(3);
          qDebug() << b->value();
          b->dumpObjectInfo();
      }
      
      #include "main.moc"
      

      It segfaults in qobject_p.h:231

       Because a signalVector which is NULL is used:

      Attachments

        Issue Links

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

          Activity

            People

              andreasbuhr Andreas Buhr
              andreasbuhr Andreas Buhr
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes