<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:"Courier New";
mso-fareast-language:EN-AU;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-AU link=blue vlink=purple><div class=WordSection1><div><div><pre style='background:white'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I find taglib trunk does not destroy TagLib::APE::File when TagLib::FileRef is set to NULL</span><span style='font-family:Consolas;color:black'><o:p></o:p></span></pre><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I am using cmake to generate VS projects and compiling static tag.lib that is statically linked in to my dll.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>In the below apeFile will hang around as not NULL but an access violation will throw if you try to access anything in it.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Eg in the below I open an APE file, followed by an MP3 file. On opening the mp3 I will get an access violation as apeFile is not NULL.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I have test files for nearly all formats TagLib supports (flac, mp3, mp4, ogg, mpc, tta, wv, wav, wma, xm) and none of the rest appear to do this.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Note this is simplified pseudo code.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><pre style='background:white'><span style='font-family:Consolas;color:black'>TagLib::APE::File *apeFile;<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'>TagLib::MPEG::File *mp3File;<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'>TagLib::FileRef fileRef;<o:p></o:p></span></pre><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><pre style='background:white'><span style='font-family:Consolas;color:blue'>Bool</span><span style='font-family:Consolas;color:#2B91AF'> </span><span style='font-family:Consolas;color:black'>GetInfo(</span><span style='font-family:Consolas;color:#2B91AF'>LPTSTR</span><span style='font-family:Consolas;color:black'> </span><span style='font-family:Consolas;color:gray'>szSource</span><span style='font-family:Consolas;color:black'>)<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'>{<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'>fileRef = TagLib::</span><span style='font-family:Consolas;color:#2B91AF'>FileRef</span><span style='font-family:Consolas;color:black'>(</span><span style='font-family:Consolas;color:gray'>szSource</span><span style='font-family:Consolas;color:black'>, 1, TagLib::</span><span style='font-family:Consolas;color:#2B91AF'>AudioProperties</span><span style='font-family:Consolas;color:black'>::</span><span style='font-family:Consolas;color:darkslategray'>Fast</span><span style='font-family:Consolas;color:black'>);<o:p></o:p></span></pre><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:blue'>if</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>( !fileRef.isNull() )<o:p></o:p></span></p><p class=MsoNormal style='background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'>{<o:p></o:p></span></p><pre style='background:white'><span style='font-family:Consolas;color:blue'> if</span><span style='font-family:Consolas;color:black'>(apeFile = </span><span style='font-family:Consolas;color:blue'>dynamic_cast</span><span style='font-family:Consolas;color:black'><TagLib::APE::</span><span style='font-family:Consolas;color:#2B91AF'>File</span><span style='font-family:Consolas;color:black'> *>( fileRef.file() ))<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> {<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> DoStuff();<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> }<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:blue'> else if</span><span style='font-family:Consolas;color:black'>(mp3File = </span><span style='font-family:Consolas;color:blue'>dynamic_cast</span><span style='font-family:Consolas;color:black'><TagLib::MPEG::</span><span style='font-family:Consolas;color:#2B91AF'>File</span><span style='font-family:Consolas;color:black'> *>( fileRef.file() ))<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> {<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> DoStuff();<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> }<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'><o:p> </o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:blue'> if</span><span style='font-family:Consolas;color:black'>(apeFile)<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> {<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> </span><span style='font-family:Consolas;color:blue'>if</span><span style='font-family:Consolas;color:black'>(apeFile->APETag()) <<Access violation for files after ape that are not ape file<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> {<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> DoAPEStuff();<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> }<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> }<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:blue'> else if</span><span style='font-family:Consolas;color:black'>(mp3File)<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> {<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> </span><span style='font-family:Consolas;color:blue'>if</span><span style='font-family:Consolas;color:black'>(mp3File->ID3v2Tag())<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> {<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> DoMP3Stuff();<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> }<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> }<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'><o:p> </o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'><o:p> </o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> fileRef = TagLib::</span><span style='font-family:Consolas;color:#2B91AF'>FileRef</span><span style='font-family:Consolas;color:black'>();<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'> </span><span style='font-family:Consolas;color:blue'>return</span><span style='font-family:Consolas;color:black'> </span><span style='font-family:Consolas;color:blue'>true</span><span style='font-family:Consolas;color:black'>;<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'><o:p> </o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'>}<o:p></o:p></span></pre><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>The stack look likes this right before the crash:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>std::vector<TagLib::Tag *,std::allocator<TagLib::Tag *> >::size() Line 1087<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>std::vector<TagLib::Tag *,std::allocator<TagLib::Tag *> >::operator[](unsigned int _Pos) Line 1138<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>TagLib::TagUnion::tag(int index) Line 96<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>TagLib::TagUnion::access<TagLib::APE::Tag>(int index, bool create) Line 79<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>TagLib::APE::File::APETag(bool create) Line 221<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>CSTDInfoManager::GetInfo(</span><span style='font-size:10.0pt;font-family:Consolas;color:gray'>szSource</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>) Line 255<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Should I be setting apeFile to NULL myself?<o:p></o:p></span></p></div></div></div></body></html>