Skip to content

Commit

Permalink
Fix deleting active cvOSCcv receiver may crash Rack
Browse files Browse the repository at this point in the history
Issue #60. Fixed where deleting an active cvOSCcv receiver may crash rack.
  • Loading branch information
chichian committed Oct 24, 2022
1 parent d3dd350 commit c7145de
Show file tree
Hide file tree
Showing 5 changed files with 353 additions and 298 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Any builds that are currently available are at [Github Releases page](https://gi
Recent builds should also be available in the [VCV plugin manager](https://library.vcvrack.com/?query=&brand=trowaSoft).

**VCV Rack v2.x.x**:
**2022-10-11**: The latest version is [v2.0.6](https://github.com/j4s0n-c/trowaSoft-VCV/releases/tag/v2.0.6) (for Rack v2.x).
**2022-10-24**: The latest version is [v2.0.6](https://github.com/j4s0n-c/trowaSoft-VCV/releases/tag/v2.0.6) (for Rack v2.x).

No more versions for older Rack versions will be developed, but they are still available here:

Expand Down
45 changes: 37 additions & 8 deletions src/Module_oscCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,43 @@ oscCV::~oscCV()
rxMsgMutex.unlock();
#endif

if (inputChannels != NULL)
delete[] inputChannels;
if (outputChannels != NULL)
delete[] outputChannels;
if (pulseGens != NULL)
delete[] pulseGens;
if (inputTriggers != NULL)
delete[] inputTriggers;
try
{
if (inputChannels != NULL)
delete[] inputChannels;
}
catch (std::exception& ex)
{
WARN("Error deleting inputChannels: %s", ex.what());
}
try
{
if (outputChannels != NULL)
delete[] outputChannels;
}
catch (std::exception& ex)
{
WARN("Error deleting outputChannels: %s", ex.what());
}

try
{
if (pulseGens != NULL)
delete[] pulseGens;
}
catch (std::exception& ex)
{
WARN("Error deleting pulseGens: %s", ex.what());
}
try
{
if (inputTriggers != NULL)
delete[] inputTriggers;
}
catch (std::exception& ex)
{
WARN("Error deleting inputTriggers: %s", ex.what());
}
return;
} // end destructor
//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
Expand Down
6 changes: 6 additions & 0 deletions src/TSOSCCV_Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ struct TSOSCCVChannel {
return;
}

~TSOSCCVChannel() {
vals.clear();
translatedVals.clear();
return;
}

virtual void initialize() {
this->convertVals = false;
this->val = 0.0;
Expand Down
Loading

0 comments on commit c7145de

Please sign in to comment.