Hello,

I am learning Qt5/QWT so that I am developping a little program. However, when I only create a QtPlotCurve (curveTime in my program), it crashes (it seems to be a segfault). If I comment the QtPlotCurve declaration is works. Could you help me please ?

Header :
Qt Code:
  1. #ifndef TABCRAMERRAOBOUND_H
  2. #define TABCRAMERRAOBOUND_H
  3.  
  4. #include <QWidget>
  5. #include <QBoxLayout>
  6. #include <QLabel>
  7. #include <QFormLayout>
  8. #include <QLineEdit>
  9. #include <qwt/qwt_plot.h>
  10. #include <qwt/qwt_plot_curve.h>
  11.  
  12. // Build tab1 called "Cramer-Rao bound"
  13. class tabCramerRaoBound : public QWidget
  14. {
  15. Q_OBJECT
  16. public:
  17. explicit tabCramerRaoBound(QWidget *parent = 0);
  18. ~tabCramerRaoBound();
  19.  
  20. signals:
  21.  
  22. public slots:
  23.  
  24. private slots:
  25.  
  26. private:
  27. void buildForm(QFormLayout * formLayout);
  28. QLineEdit * lineEdit;
  29. QwtPlot * myPlot;
  30. QwtPlotCurve * curveTime;
  31. };
  32.  
  33. #endif // TABCRAMERRAOBOUND_H
To copy to clipboard, switch view to plain text mode 

Source :
Qt Code:
  1. #include "tabCramerRaoBound.h"
  2.  
  3. tabCramerRaoBound::tabCramerRaoBound(QWidget *parent) : QWidget(parent) {
  4.  
  5. // Construct the window
  6. QVBoxLayout * layoutV1 = new QVBoxLayout(this);
  7. setLayout(layoutV1);
  8.  
  9. // Separation
  10. QFrame * line1 = new QFrame();
  11. line1->setFrameShape(QFrame::HLine);
  12. line1->setFrameShadow(QFrame::Sunken);
  13.  
  14. // Layouts
  15. QHBoxLayout * layoutH2 = new QHBoxLayout();
  16. QFormLayout * formLayout = new QFormLayout();
  17. tabCramerRaoBound::buildForm(formLayout);
  18.  
  19. // Separation
  20. QFrame * line2 = new QFrame();
  21. line2->setFrameShape(QFrame::VLine);
  22. line2->setFrameShadow(QFrame::Sunken);
  23.  
  24. // Graphic
  25. myPlot = new QwtPlot();
  26. curveTime = new QwtPlotCurve("Time CRB");
  27.  
  28. // Place widgets
  29. layoutV1->addWidget(line1);
  30. layoutH2->addLayout(formLayout);
  31. layoutH2->addWidget(line2);
  32. layoutH2->addWidget(myPlot);
  33. layoutV1->addLayout(layoutH2);
  34. }
  35.  
  36. tabCramerRaoBound::~tabCramerRaoBound() {
  37. }
  38.  
  39. void tabCramerRaoBound::buildForm(QFormLayout * formLayout) {
  40.  
  41. // Read user configuration
  42. QLabel * label1 = new QLabel(tr("<b>Test:</b>"));
  43. formLayout->addRow(label1);
  44. QLabel * label2 = new QLabel(tr("Parametre:"));
  45. lineEdit = new QLineEdit();
  46. formLayout->addRow(label2, lineEdit);
  47.  
  48. }
To copy to clipboard, switch view to plain text mode 

Here is the kind of error :
Qt Code:
  1. Starting /home/julien/Bureau/Devs/synchro tool hand/build-synchronization_tool-Desktop-Debug/synchronization_tool...
  2. *** Error in `/home/julien/Bureau/Devs/synchro tool hand/build-synchronization_tool-Desktop-Debug/synchronization_tool': double free or corruption (out): 0x0000000000fc97e0 ***
  3. ======= Backtrace: =========
  4. /lib/x86_64-linux-gnu/libc.so.6(+0x80a46)[0x7f98ec112a46]
  5. /usr/local/qwt-6.1.0/lib/libqwt.so.6(_ZN7QwtPlotD1Ev+0xed)[0x7f98ee11540d]
  6. /usr/local/qwt-6.1.0/lib/libqwt.so.6(_ZN7QwtPlotD0Ev+0x9)[0x7f98ee115489]
  7. /usr/lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN14QObjectPrivate14deleteChildrenEv+0x6e)[0x7f98ecea5eee]
  8. /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(_ZN7QWidgetD2Ev+0x2df)[0x7f98ed9d81cf]
To copy to clipboard, switch view to plain text mode 

Thanks !!