mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
Undo a global effect with RAII
This commit is contained in:
@@ -336,6 +336,9 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
// Rememebr the old blocksize, so that we can restore it later.
|
// Rememebr the old blocksize, so that we can restore it later.
|
||||||
auto oldBlockSize = Sequence::GetMaxDiskBlockSize();
|
auto oldBlockSize = Sequence::GetMaxDiskBlockSize();
|
||||||
|
const auto cleanup = finally([=]
|
||||||
|
{ Sequence::SetMaxDiskBlockSize(oldBlockSize); }
|
||||||
|
);
|
||||||
Sequence::SetMaxDiskBlockSize(blockSize * 1024);
|
Sequence::SetMaxDiskBlockSize(blockSize * 1024);
|
||||||
|
|
||||||
wxBusyCursor busy;
|
wxBusyCursor busy;
|
||||||
@@ -535,7 +538,6 @@ void BenchmarkDialog::OnRun( wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
dd.reset();
|
dd.reset();
|
||||||
|
|
||||||
Sequence::SetMaxDiskBlockSize(oldBlockSize);
|
|
||||||
Printf(wxT("Benchmark completed successfully.\n"));
|
Printf(wxT("Benchmark completed successfully.\n"));
|
||||||
HoldPrint(false);
|
HoldPrint(false);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user