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: 2d8dba0ad364
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: c6a6a44e483f
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Mar 13, 2020

  1. Copy the full SHA
    79e538a View commit details
  2. Copy the full SHA
    c6a6a44 View commit details
Showing with 56 additions and 13 deletions.
  1. +5 −1 glscopeclient/HistoryWindow.cpp
  2. +15 −2 glscopeclient/OscilloscopeWindow.cpp
  3. +27 −6 glscopeclient/ScopeApp.cpp
  4. +8 −1 glscopeclient/ScopeApp.h
  5. +1 −3 glscopeclient/main.cpp
6 changes: 5 additions & 1 deletion glscopeclient/HistoryWindow.cpp
Original file line number Diff line number Diff line change
@@ -97,7 +97,11 @@ HistoryWindow::~HistoryWindow()
{
WaveformHistory hist = it[m_columns.m_history];
for(auto w : hist)
delete w.second;
{
//Do *not* delete the channel's current data!
if(w.second != w.first->GetData())
delete w.second;
}
}
}

17 changes: 15 additions & 2 deletions glscopeclient/OscilloscopeWindow.cpp
Original file line number Diff line number Diff line change
@@ -383,9 +383,22 @@ void OscilloscopeWindow::CloseSession()
m_waveformGroups.clear();
m_waveformAreas.clear();

//TODO: delete stuff from our UI
//Delete stuff from our UI

//TODO: close stuff in the application, terminate threads, etc
//Purge our list of scopes (the app will delete them)
m_scopes.clear();

//Clear performance counters
m_tAcquire = 0;
m_tDecode = 0;
m_tView = 0;
m_tHistory = 0;
m_tPoll = 0;
m_tEvent = 0;
m_lastWaveformTimes.clear();

//Close stuff in the application, terminate threads, etc
g_app->ShutDownSession();
}

/**
33 changes: 27 additions & 6 deletions glscopeclient/ScopeApp.cpp
Original file line number Diff line number Diff line change
@@ -39,11 +39,7 @@ using namespace std;

ScopeApp::~ScopeApp()
{
for(auto t : m_threads)
{
t->join();
delete t;
}
ShutDownSession();
}

void ScopeApp::run()
@@ -65,12 +61,37 @@ void ScopeApp::run()
break;
}

g_terminating = true;
m_terminating = true;

delete m_window;
m_window = NULL;
}

/**
@brief Shuts down the current session and disconnects from all instruments but don't close the window
*/
void ScopeApp::ShutDownSession()
{
//Set terminating flag so all current ScopeThread's terminate
m_terminating = true;

//Wait for all threads to shut down and remove them
for(auto t : m_threads)
{
t->join();
delete t;
}
m_threads.clear();

//Clean up scopes
for(auto scope : m_scopes)
delete scope;
m_scopes.clear();

//Back to normal mode
m_terminating = false;
}

/**
@brief Create windows for each instrument
*/
9 changes: 8 additions & 1 deletion glscopeclient/ScopeApp.h
Original file line number Diff line number Diff line change
@@ -43,6 +43,7 @@ class ScopeApp : public Gtk::Application
public:
ScopeApp()
: Gtk::Application()
, m_terminating(false)
, m_window(NULL)
{}

@@ -52,7 +53,14 @@ class ScopeApp : public Gtk::Application

virtual void run();

void ShutDownSession();

bool IsTerminating()
{ return m_terminating; }

protected:
bool m_terminating;

OscilloscopeWindow* m_window;

virtual void on_activate();
@@ -63,6 +71,5 @@ class ScopeApp : public Gtk::Application
void ScopeThread(Oscilloscope* scope);

extern ScopeApp* g_app;
extern bool g_terminating;

#endif
4 changes: 1 addition & 3 deletions glscopeclient/main.cpp
Original file line number Diff line number Diff line change
@@ -49,8 +49,6 @@ using namespace std;
//for color selection
int g_numDecodes = 0;

bool g_terminating = false;

ScopeApp* g_app = NULL;

int main(int argc, char* argv[])
@@ -198,7 +196,7 @@ void ScopeThread(Oscilloscope* scope)
uint32_t delay_max = 500 * 1000;
uint32_t delay_min = 250;
double dt = 0;
while(!g_terminating)
while(!g_app->IsTerminating())
{
size_t npending = scope->GetPendingWaveformCount();