fix a memory leak in KaxReferenceBlock when an internal KaxBlockBlob was created
git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libmatroska@546 a6f86f6d-0131-4f8e-9e7b-e335508773d5
This commit is contained in:
parent
f1349f9639
commit
697ce73358
@ -6,6 +6,7 @@ New 1.1.0 version:
|
|||||||
- add the possibility for a DataBuffer class to use its own internal memory
|
- add the possibility for a DataBuffer class to use its own internal memory
|
||||||
- KaxCues::AddBlockGroup() was removed as it's broken beyond repair
|
- KaxCues::AddBlockGroup() was removed as it's broken beyond repair
|
||||||
- add KaxTrackOperation and related elements for combined stereo/3D tracks or joined virtual tracks
|
- add KaxTrackOperation and related elements for combined stereo/3D tracks or joined virtual tracks
|
||||||
|
- fix a memory leak in KaxReferenceBlock when an internal KaxBlockBlob was created
|
||||||
|
|
||||||
2010-06-04 robux4/mosu
|
2010-06-04 robux4/mosu
|
||||||
New 1.0.0 version:
|
New 1.0.0 version:
|
||||||
|
@ -55,6 +55,7 @@ DECLARE_MKX_UINTEGER(KaxReferencePriority)
|
|||||||
*/
|
*/
|
||||||
DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock)
|
DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock)
|
||||||
public:
|
public:
|
||||||
|
~KaxReferenceBlock();
|
||||||
/*!
|
/*!
|
||||||
\brief override this method to compute the timecode value
|
\brief override this method to compute the timecode value
|
||||||
*/
|
*/
|
||||||
@ -70,6 +71,8 @@ DECLARE_MKX_SINTEGER_CONS(KaxReferenceBlock)
|
|||||||
const KaxBlockGroup * ParentBlock;
|
const KaxBlockGroup * ParentBlock;
|
||||||
void SetReferencedTimecode(int64 refTimecode) {*static_cast<EbmlSInteger*>(this) = refTimecode; bTimecodeSet = true;};
|
void SetReferencedTimecode(int64 refTimecode) {*static_cast<EbmlSInteger*>(this) = refTimecode; bTimecodeSet = true;};
|
||||||
bool bTimecodeSet;
|
bool bTimecodeSet;
|
||||||
|
bool bOurBlob;
|
||||||
|
void FreeBlob();
|
||||||
};
|
};
|
||||||
|
|
||||||
#if MATROSKA_VERSION >= 2
|
#if MATROSKA_VERSION >= 2
|
||||||
|
@ -84,9 +84,22 @@ RefdBlock(NULL)
|
|||||||
KaxReferenceBlock::KaxReferenceBlock(const KaxReferenceBlock & ElementToClone)
|
KaxReferenceBlock::KaxReferenceBlock(const KaxReferenceBlock & ElementToClone)
|
||||||
:EbmlSInteger(ElementToClone)
|
:EbmlSInteger(ElementToClone)
|
||||||
,bTimecodeSet(ElementToClone.bTimecodeSet)
|
,bTimecodeSet(ElementToClone.bTimecodeSet)
|
||||||
|
,bOurBlob(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KaxReferenceBlock::~KaxReferenceBlock()
|
||||||
|
{
|
||||||
|
FreeBlob();
|
||||||
|
}
|
||||||
|
|
||||||
|
void KaxReferenceBlock::FreeBlob()
|
||||||
|
{
|
||||||
|
if (bOurBlob && RefdBlock!=NULL)
|
||||||
|
delete RefdBlock;
|
||||||
|
RefdBlock = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
filepos_t KaxReferenceBlock::UpdateSize(bool bSaveDefault, bool bForceRender)
|
filepos_t KaxReferenceBlock::UpdateSize(bool bSaveDefault, bool bForceRender)
|
||||||
{
|
{
|
||||||
if (!bTimecodeSet) {
|
if (!bTimecodeSet) {
|
||||||
@ -103,15 +116,19 @@ void KaxReferenceBlock::SetReferencedBlock(const KaxBlockBlob * aRefdBlock)
|
|||||||
{
|
{
|
||||||
assert(RefdBlock == NULL);
|
assert(RefdBlock == NULL);
|
||||||
assert(aRefdBlock != NULL);
|
assert(aRefdBlock != NULL);
|
||||||
|
FreeBlob();
|
||||||
RefdBlock = aRefdBlock;
|
RefdBlock = aRefdBlock;
|
||||||
|
bOurBlob = true;
|
||||||
SetValueIsSet();
|
SetValueIsSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KaxReferenceBlock::SetReferencedBlock(const KaxBlockGroup & aRefdBlock)
|
void KaxReferenceBlock::SetReferencedBlock(const KaxBlockGroup & aRefdBlock)
|
||||||
{
|
{
|
||||||
|
FreeBlob();
|
||||||
KaxBlockBlob *block_blob = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
|
KaxBlockBlob *block_blob = new KaxBlockBlob(BLOCK_BLOB_NO_SIMPLE);
|
||||||
block_blob->SetBlockGroup(*const_cast<KaxBlockGroup*>(&aRefdBlock));
|
block_blob->SetBlockGroup(*const_cast<KaxBlockGroup*>(&aRefdBlock));
|
||||||
RefdBlock = block_blob;
|
RefdBlock = block_blob;
|
||||||
|
bOurBlob = true;
|
||||||
SetValueIsSet();
|
SetValueIsSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user