Fix crashes in Drag and Drop if the drop target is the same as the current dragged item

This commit is contained in:
Gaute Lindkvist 2020-07-03 14:49:59 +02:00
parent da6360cf98
commit a9c9471e7f
3 changed files with 18 additions and 6 deletions

View File

@ -47,6 +47,8 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( RimWellLogTra
{
RimWellLogCurve* curve = curves[cIdx];
if ( curve == curveToInsertBeforeOrAfter ) continue;
RimWellLogTrack* wellLogPlotTrack;
curve->firstAncestorOrThisOfType( wellLogPlotTrack );
if ( wellLogPlotTrack )

View File

@ -1078,13 +1078,20 @@ void RimWellLogTrack::addCurve( RimWellLogCurve* curve )
//--------------------------------------------------------------------------------------------------
void RimWellLogTrack::insertCurve( RimWellLogCurve* curve, size_t index )
{
m_curves.insert( index, curve );
connectCurveSignals( curve );
// Todo: Mark curve data to use either TVD or MD
if ( m_plotWidget )
if ( index >= m_curves.size() )
{
curve->setParentQwtPlotAndReplot( m_plotWidget );
addCurve( curve );
}
else
{
m_curves.insert( index, curve );
connectCurveSignals( curve );
// Todo: Mark curve data to use either TVD or MD
if ( m_plotWidget )
{
curve->setParentQwtPlotAndReplot( m_plotWidget );
}
}
}

View File

@ -444,6 +444,9 @@ void RimSummaryCurveCollection::moveCurvesToCollection( RimSummaryCurveCollectio
for ( auto curve : curves )
{
RimSummaryCurveCollection* srcCollection = nullptr;
if ( curve == curveToInsertBeforeOrAfter ) continue;
curve->firstAncestorOrThisOfTypeAsserted( srcCollection );
srcCollection->removeCurve( curve );