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
|
|
@ -121,3 +121,11 @@ void sfz::FilePool::loadingThread() noexcept
|
||||||
fileToLoad.voice->setFileData(readFromFile<float>(sndFile, fileToLoad.numFrames), fileToLoad.ticket);
|
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;
|
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 enqueueLoading(Voice* voice, std::string_view sample, int numFrames, unsigned ticket) noexcept;
|
||||||
|
void clear();
|
||||||
private:
|
private:
|
||||||
std::filesystem::path rootDirectory;
|
std::filesystem::path rootDirectory;
|
||||||
struct FileLoadingInformation {
|
struct FileLoadingInformation {
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,7 @@ void sfz::Synth::clear()
|
||||||
masterOpcodes.clear();
|
masterOpcodes.clear();
|
||||||
groupOpcodes.clear();
|
groupOpcodes.clear();
|
||||||
regions.clear();
|
regions.clear();
|
||||||
|
filePool.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void sfz::Synth::handleGlobalOpcodes(const std::vector<Opcode>& members)
|
void sfz::Synth::handleGlobalOpcodes(const std::vector<Opcode>& members)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue