Skip to content

Commit

Permalink
[teleplot] clear callbacks on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed May 28, 2024
1 parent eef5e17 commit 67c6e03
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/plugins/score-plugin-avnd/AvndProcesses/Teleplot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ struct Teleplot : PatternObject
{
} outputs;

~Teleplot() { clear(); }

std::pair<std::string, uint16_t> resolve_ip(const std::string& host)
{
try
Expand Down Expand Up @@ -69,14 +71,19 @@ struct Teleplot : PatternObject
return {};
}

void update()
void clear()
{
// 1. Remove existing callbacks
for(auto& [param, cb] : params)
{
param->remove_callback(cb);
}
params.clear();
}

void update()
{
// 1. Remove existing callbacks
clear();

// 2. recreate socket
{
Expand Down

0 comments on commit 67c6e03

Please sign in to comment.