SIGSEGV, QVector



  • I can't understand. I created a class with QVector inside that takes another class and a method by which this class can be added. And the problem is, every time I use this method throws me out, the program doesn't answer. Debagger says it's SIGSEGV and sends me to this line.

    void QVector<T>::append(const T &t)
    {
    const bool isTooSmall = uint(d->size + 1) > d->alloc; //Вот эта строчка
    

    ♪ ♪ ♪



  • Failures to work with memory do not occur where a code error has been made. So it's not necessary that since the debagger sent you to this line, it's the mistake. Besides, it's not your code, it's the Qt library code, and all the libraries need to be considered unheated until proven otherwise. The addition of any class to the vector may be as follows.

    class SomeClass : public QObject
    {
        explicit SomeClass(QObject *parent = nullptr);
    }
    

    ...

    QVector<SomeClass> vector;
    SomeClass a, b, c;
    vector.append(a);
    vector.append(b);
    vector.append(c);


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2