Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e11610eac9d5
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 247acb95dc72
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Sep 1, 2020

  1. OscilloscopeWindow: flush old waveforms when loading from a file, but…

    … properly detach new ones
    azonenberg committed Sep 1, 2020
    Copy the full SHA
    247acb9 View commit details
Showing with 9 additions and 2 deletions.
  1. +9 −2 src/glscopeclient/OscilloscopeWindow.cpp
11 changes: 9 additions & 2 deletions src/glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -676,6 +676,14 @@ void OscilloscopeWindow::LoadWaveformDataForScope(
auto window = m_historyWindows[scope];
int scope_id = table[scope];

//Clear out any old waveforms the instrument may have
for(size_t i=0; i<scope->GetChannelCount(); i++)
{
auto chan = scope->GetChannel(i);
for(size_t j=0; j<chan->GetStreamCount(); j++)
chan->SetData(NULL, j);
}

auto wavenode = node["waveforms"];
window->SetMaxWaveforms(wavenode.size());
for(auto it : wavenode)
@@ -686,8 +694,6 @@ void OscilloscopeWindow::LoadWaveformDataForScope(
time.second = wfm["time_psec"].as<long long>();
int waveform_id = wfm["id"].as<int>();

//Don't worry about detaching or deleting old waveforms, they'll get cleaned up when we SetData

//Set up channel metadata first (serialized)
auto chans = wfm["channels"];
vector<int> channels;
@@ -716,6 +722,7 @@ void OscilloscopeWindow::LoadWaveformDataForScope(
cap->m_startPicoseconds = time.second;
cap->m_triggerPhase = ch["trigphase"].as<float>();

chan->Detach(stream);
chan->SetData(cap, stream);
}