Skip to content

Commit 63d71e8

Browse files
committed
Fix swap background/secondary with foreground messing up for multi-sample files.
Was using a reference to displayed samples (set<int>), which changed from what was actually wanted - switched to using a copy.
1 parent 8839493 commit 63d71e8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/CompactFileManager.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,19 +1332,19 @@ void CompactFileManager::handleSwapWithForeground( const SpecUtils::SpectrumType
13321332
return;
13331333

13341334
const shared_ptr<SpecMeas> meas = m_interspec->measurment(type);
1335-
const set<int> &samples = m_interspec->displayedSamples(type);
1335+
const set<int> samples = m_interspec->displayedSamples(type);
13361336
const vector<string> detectors = m_interspec->detectorsToDisplay(type);
13371337

13381338
// When we set the foreground, the background or secondary may get cleared, so we'll re-set that.
13391339
const SpecUtils::SpectrumType other_type = (type == SpecUtils::SpectrumType::Background)
13401340
? SpecUtils::SpectrumType::SecondForeground
13411341
: SpecUtils::SpectrumType::Background;
13421342
const shared_ptr<SpecMeas> other_meas = m_interspec->measurment(other_type);
1343-
const set<int> &other_samples = m_interspec->displayedSamples(other_type);
1343+
const set<int> other_samples = m_interspec->displayedSamples(other_type);
13441344
const vector<string> other_detectors = m_interspec->detectorsToDisplay(other_type);
13451345

13461346
const shared_ptr<SpecMeas> foreground_meas = m_interspec->measurment(SpecUtils::SpectrumType::Foreground);
1347-
const set<int> &foreground_samples = m_interspec->displayedSamples(SpecUtils::SpectrumType::Foreground);
1347+
const set<int> foreground_samples = m_interspec->displayedSamples(SpecUtils::SpectrumType::Foreground);
13481348
const vector<string> foreground_detectors = m_interspec->detectorsToDisplay(SpecUtils::SpectrumType::Foreground);
13491349

13501350
const Wt::WModelIndex index = m_files->index(meas);

0 commit comments

Comments
 (0)