I have a snap of code like this :
void updateCurves {
QwtPlotItemList list = plot->itemList();
foreach (QwtPlotItem * item, list) {
qDebug() << " updateCurvesPosition1 " << item;
qDebug() << "updateCurvesPosition 1 " << item->rtti();
if (item->rtti() == QwtPlotItem::RttiValues(BaseCurve::Rtti_BaseCurveS tyle) ) {
BaseCurve *curve = static_cast<BaseCurve *>(item);
BaseLegendConfigData::CurveType type = curve->curveConfig()->getCurveType();
......
}
}
replot();
QwtPlotItemList curlist = plot->itemList();
foreach (QwtPlotItem *item, curlist) {
qDebug() << " updateCurvesPosition 2" << item;
qDebug() << "updateCurvesPosition 2 " << item->rtti(); /// crash here .
if (item->rtti() == QwtPlotItem::RttiValues(BaseCurve::Rtti_BaseCurveS tyle)) {
BaseCurve *curve = static_cast<BaseCurve *>(item);
.........
}
}
}
}
The first part and the second part are almost the same, but the red line would cause crash.
Added after 16 minutes:
o , i know why , sorry ,my mistake.
Bookmarks