deepet
20th February 2013, 15:45
Hi.
I have a problem in Qwt 6.0, when i make delete of an qwtplot object. For example:
#include <QObject>
class QwtPlot;
class QwtPlotCurve;
class myClass : public QObject {
public:
myClass(QWidgte *parent, double *xData, double *xData, int TDataSize);
~myClass();
private:
QwtPlot *plot;
QwtPlotCurve *curve;
}
myClass:myClass(QWidgte *parent_, double *xData, double *xData, int TDataSize) {
plot = new QwtPlot(parent_);
curve = new QwtPlotCurve();
curve->attach(plot);
curve->setStyle(QwtPlotCurve::NoCurve);
curve->setSymbol(new QwtSymbol(QwtSymbol::Ellipse, QBrush(Qt::darkMagenta), QPen(Qt::darkMagenta), QSize(6, 6)));
curve->setPen(QPen(QColor(0, 0, 255)));
curve->setRawSamples(xDados, yDados, TDataSize-1);
}
myClass:~myClass() {
curve->attach(NULL);
delete curve;
delete plot; // with this crash
}
If I don't do
delete plot; and only do delete the myClass object I don't have problem, but I think that this isn't the correct way for doing this.
Other thing is that in the old version of Qwt, Qwt 5; I did do
delete plot; without any problem.
In Visual Studio 2010 the error message is: "Unhandled exception at 0x775415de in myApp.exe: 0xC0000005: Access violation."
Someone can help me?
Thanks.
I have a problem in Qwt 6.0, when i make delete of an qwtplot object. For example:
#include <QObject>
class QwtPlot;
class QwtPlotCurve;
class myClass : public QObject {
public:
myClass(QWidgte *parent, double *xData, double *xData, int TDataSize);
~myClass();
private:
QwtPlot *plot;
QwtPlotCurve *curve;
}
myClass:myClass(QWidgte *parent_, double *xData, double *xData, int TDataSize) {
plot = new QwtPlot(parent_);
curve = new QwtPlotCurve();
curve->attach(plot);
curve->setStyle(QwtPlotCurve::NoCurve);
curve->setSymbol(new QwtSymbol(QwtSymbol::Ellipse, QBrush(Qt::darkMagenta), QPen(Qt::darkMagenta), QSize(6, 6)));
curve->setPen(QPen(QColor(0, 0, 255)));
curve->setRawSamples(xDados, yDados, TDataSize-1);
}
myClass:~myClass() {
curve->attach(NULL);
delete curve;
delete plot; // with this crash
}
If I don't do
delete plot; and only do delete the myClass object I don't have problem, but I think that this isn't the correct way for doing this.
Other thing is that in the old version of Qwt, Qwt 5; I did do
delete plot; without any problem.
In Visual Studio 2010 the error message is: "Unhandled exception at 0x775415de in myApp.exe: 0xC0000005: Access violation."
Someone can help me?
Thanks.