mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4565 Highlight Curves : Clicking on curve causes access violation
Create a copy of the item list before the loop to avoid invalidated iterators when iterating the list plotCurve->setZ() causes the ordering of items in the list to change
This commit is contained in:
parent
7b3155ab33
commit
10e3180332
@ -244,7 +244,10 @@ void RiuQwtPlot::selectClosestCurve(const QPoint& pos)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlot::highlightCurve(const QwtPlotCurve* closestCurve)
|
||||
{
|
||||
for (QwtPlotItem* plotItem : this->itemList())
|
||||
// NB! Create a copy of the item list before the loop to avoid invalidated iterators when iterating the list
|
||||
// plotCurve->setZ() causes the ordering of items in the list to change
|
||||
auto plotItemList = this->itemList();
|
||||
for (QwtPlotItem* plotItem : plotItemList)
|
||||
{
|
||||
QwtPlotCurve* plotCurve = dynamic_cast<QwtPlotCurve*>(plotItem);
|
||||
if (plotCurve)
|
||||
@ -293,7 +296,10 @@ void RiuQwtPlot::highlightCurve(const QwtPlotCurve* closestCurve)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuQwtPlot::resetCurveHighlighting()
|
||||
{
|
||||
for (QwtPlotItem* plotItem : this->itemList())
|
||||
// NB! Create a copy of the item list before the loop to avoid invalidated iterators when iterating the list
|
||||
// plotCurve->setZ() causes the ordering of items in the list to change
|
||||
auto plotItemList = this->itemList();
|
||||
for (QwtPlotItem* plotItem : plotItemList)
|
||||
{
|
||||
QwtPlotCurve* plotCurve = dynamic_cast<QwtPlotCurve*>(plotItem);
|
||||
if (plotCurve && m_originalCurveColors.count(plotCurve))
|
||||
|
Loading…
Reference in New Issue
Block a user