1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

Applying Paul's fix for bug #818

While I didn't see the crash in action, the patch definitely
fixes the possibility of one.
This commit is contained in:
lllucius 2015-01-20 06:34:55 +00:00
parent 45c5bdfa45
commit 09c213feed
2 changed files with 10 additions and 6 deletions

View File

@ -934,15 +934,19 @@ BlockFile *DirManager::NewODDecodeBlockFile(
return newBlockFile;
}
bool DirManager::ContainsBlockFile(BlockFile *b)
bool DirManager::ContainsBlockFile(BlockFile *b) const
{
return b ? mBlockFileHash[b->GetFileName().GetName()] == b : false;
if (!b)
return false;
BlockHash::const_iterator it = mBlockFileHash.find(b->GetFileName().GetName());
return it != mBlockFileHash.end() && it->second == b;
}
bool DirManager::ContainsBlockFile(wxString filepath)
bool DirManager::ContainsBlockFile(wxString filepath) const
{
// check what the hash returns in case the blockfile is from a different project
return mBlockFileHash[filepath] != NULL;
BlockHash::const_iterator it = mBlockFileHash.find(filepath);
return it != mBlockFileHash.end();
}
// Adds one to the reference count of the block file,

View File

@ -71,9 +71,9 @@ class DirManager: public XMLTagHandler {
sampleCount aliasLen, int aliasChannel, int decodeType);
/// Returns true if the blockfile pointed to by b is contained by the DirManager
bool ContainsBlockFile(BlockFile *b);
bool ContainsBlockFile(BlockFile *b) const;
/// Check for existing using filename using complete filename
bool ContainsBlockFile(wxString filepath);
bool ContainsBlockFile(wxString filepath) const;
// Adds one to the reference count of the block file,
// UNLESS it is "locked", then it makes a new copy of