When two colorMap use the same data and copy is false, the data will be deleted twice.
QCPColorMap::~QCPColorMap() { delete mMapData; } void QCPColorMap::setData(QCPColorMapData *data, bool copy) { if (mMapData == data) { qDebug() << Q_FUNC_INFO << "The data pointer is already in (and owned by) this plottable" << reinterpret_cast<quintptr>(data); return; } if (copy) { *mMapData = *data; } else { delete mMapData; mMapData = data; } mMapImageInvalidated = true; }