13
0

Fix SesionhandlRef when rebuilding peak-files

Since rebuilding peaks does not call drop-references, the WaveView
is not explicitly released. and ArdourWaveView::WaveView
keeps a shared pointer reference to the AudioRegion.

This also fixes a memory leak, waves, tmp_waves store C++ pointers,
not shared pointers. Explicit delete is required
This commit is contained in:
Robin Gareus 2020-03-30 21:19:31 +02:00
parent 7701e5ecb9
commit 070d8f5ee1
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -1156,9 +1156,14 @@ AudioRegionView::delete_waves ()
for (vector<ArdourWaveView::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) { for (vector<ArdourWaveView::WaveView*>::iterator w = waves.begin(); w != waves.end(); ++w) {
group->remove(*w); group->remove(*w);
delete *w;
} }
waves.clear(); waves.clear();
tmp_waves.clear();
while (!tmp_waves.empty ()) {
delete tmp_waves.back ();
tmp_waves.pop_back ();
}
pending_peak_data->show (); pending_peak_data->show ();
} }
@ -1304,8 +1309,12 @@ AudioRegionView::create_one_wave (uint32_t which, bool /*direct*/)
/* all waves are ready */ /* all waves are ready */
tmp_waves.resize(nwaves); tmp_waves.resize(nwaves);
waves = tmp_waves; waves.swap(tmp_waves);
tmp_waves.clear ();
while (!tmp_waves.empty ()) {
delete tmp_waves.back ();
tmp_waves.pop_back ();
}
/* indicate peak-completed */ /* indicate peak-completed */
pending_peak_data->hide (); pending_peak_data->hide ();