Hello.

I have a problem with my QwtPlot-derived class:
Qt Code:
  1. class Plot2D : public QwtPlot
  2. {
  3. public:
  4. Plot2D(QWidget *parent);
  5. ~Plot2D();
  6.  
  7. private:
  8. QwtPlotSpectrogram *meshGrid;
  9. SpectrogramData *meshData; // public : QwtRasterData,
  10. ColorMap *meshMap; // : public QwtColorMap
  11. // These two classes use their respective default destructors. No memory allocation takes place inside these classes.
  12. QwtScaleDraw *scaleDraw;
  13. QwtScaleWidget *rightAxis;
  14. };
To copy to clipboard, switch view to plain text mode 
Its constructor and destructor are set to:
Qt Code:
  1. Plot2D::Plot2D(QWidget *parent) :
  2. QwtPlot(parent),
  3. meshGrid(new QwtPlotSpectrogram()),
  4. meshData(new SpectrogramData()),
  5. meshMap(new ColorMap()),
  6. scaleDraw(new QwtScaleDraw())
  7. {
  8. meshGrid->attach(this);
  9. meshGrid->setData(meshData);
  10. meshGrid->setColorMap(meshMap);
  11. rightAxis = axisWidget(QwtPlot::yRight);
  12. rightAxis->setColorBarEnabled(true);
  13. enableAxis(QwtPlot::yRight);
  14. setAxisScaleDraw(QwtPlot::yLeft,scaleDraw);
  15. }
  16. Plot2D::~Plot2D()
  17. {
  18. delete scaleDraw;
  19. delete meshMap;
  20. delete meshData;
  21. delete meshGrid;
  22. }
To copy to clipboard, switch view to plain text mode 
My program halts and eventually throws an error if I simply run it and subsequently close it (upon deleting the Plot2D object). This simple procedure is completed successfully if I comment out the bracketed instructions on either constructor or destructor. I'm guessing that there is something wrong with my implementation of memory management here. What might be the problem?