Important: Please read the Qt Code of Conduct -

Segmentation error for simply HAVING a QVector in my class...

  • Hello everybody and Merry Christmas.

    I am compiling my program with the Qt 5.4.2 MinGW 32 bit compiler and am having a bizarre issue at run time. I have a class with a private QVector <double> variable. I have of course included QVector.h in the preamble of my header.
    Whenever I try to create an instance of the class at rubtime, a segmentation fault occurs. If I run in debugger mode the debugger jumps to the following line in QVector.h:

        inline ~QVector() { if (!d->ref.deref()) freeData(d); }

    If I comment out the line where I declare my variable:

    QVector < double > PitchAngles;       //Blade pitch angle

    The program compiles and works without a problem. Most bizarre of all, I use many hundreds of instances of QVector in other classes in the program, and they work without a problem. I really don't understand what the problem could be.
    Any help is appreciated.

  • Lifetime Qt Champion

    Hi and welcome
    I think we need more code around
    QVector < double > PitchAngles; //Blade pitch angle

    To give guesses.
    It does sounds odd.

Log in to reply