Skip to content

Commit

Permalink
Fix crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
giulioz committed Jan 22, 2025
1 parent 0edbd55 commit 7eae1cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions rdpiano_juce/Source/PluginEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ RdPiano_juceAudioProcessorEditor::RdPiano_juceAudioProcessorEditor(

RdPiano_juceAudioProcessorEditor::~RdPiano_juceAudioProcessorEditor() {
alphaDial.setLookAndFeel(nullptr);
audioProcessor.removeChangeListener(this);
}

void RdPiano_juceAudioProcessorEditor::resized() {
Expand Down
10 changes: 8 additions & 2 deletions rdpiano_juce/Source/PluginProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,14 @@ void RdPiano_juceAudioProcessor::prepareToPlay(double sampleRate,
}

void RdPiano_juceAudioProcessor::releaseResources() {
delete[] dry_sample_buffer;
delete[] dry_resampled_sample_buffer;
if (dry_sample_buffer) {
delete[] dry_sample_buffer;
dry_sample_buffer = 0;
}
if (dry_resampled_sample_buffer) {
delete[] dry_resampled_sample_buffer;
dry_resampled_sample_buffer = 0;
}
}

bool RdPiano_juceAudioProcessor::isBusesLayoutSupported(
Expand Down
4 changes: 2 additions & 2 deletions rdpiano_juce/Source/PluginProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class RdPiano_juceAudioProcessor : public juce::AudioProcessor,
int savedSourceSampleRate = 0;
double samplesError = 0;

float *dry_sample_buffer;
float *dry_resampled_sample_buffer;
float *dry_sample_buffer = 0;
float *dry_resampled_sample_buffer = 0;
size_t dry_sample_buffer_size = 0;

unsigned long chorusPhase = 0;
Expand Down

0 comments on commit 7eae1cf

Please sign in to comment.