Corrected a bug when reloading files, where the string views used for the FilePool hash table where pointing towards freed memory.
This commit is contained in:
parent
5b17f727d8
commit
e028fdced9
3 changed files with 10 additions and 0 deletions
|
|
@ -120,4 +120,12 @@ void sfz::FilePool::loadingThread() noexcept
|
|||
auto fileLoaded = std::make_unique<AudioBuffer<float>>(sndFile.channels(), fileToLoad.numFrames);
|
||||
fileToLoad.voice->setFileData(readFromFile<float>(sndFile, fileToLoad.numFrames), fileToLoad.ticket);
|
||||
}
|
||||
}
|
||||
|
||||
void sfz::FilePool::clear()
|
||||
{
|
||||
preloadedData.clear();
|
||||
while(loadingQueue.pop()){
|
||||
// Pop the queue
|
||||
}
|
||||
}
|
||||
|
|
@ -59,6 +59,7 @@ public:
|
|||
};
|
||||
std::optional<FileInformation> getFileInformation(std::string_view filename, uint32_t offset) noexcept;
|
||||
void enqueueLoading(Voice* voice, std::string_view sample, int numFrames, unsigned ticket) noexcept;
|
||||
void clear();
|
||||
private:
|
||||
std::filesystem::path rootDirectory;
|
||||
struct FileLoadingInformation {
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ void sfz::Synth::clear()
|
|||
masterOpcodes.clear();
|
||||
groupOpcodes.clear();
|
||||
regions.clear();
|
||||
filePool.clear();
|
||||
}
|
||||
|
||||
void sfz::Synth::handleGlobalOpcodes(const std::vector<Opcode>& members)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue