<div dir="ltr">Hi there,<div><br></div><div>I am using taglib for a Windows application and I am trying to add cover art to a MP4 file. Unfortunately I am getting a "Debug Assertion Failed!" error from the Microsoft Visual C++ Runtime Library.</div>
<div><div>File: f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c</div><div>Line: 1424</div><div><br></div><div>Expression: _pFirstBlock == pHead</div></div><div><br></div><div>I have already had such an error when I tried to delete an object which was already destructed by the library.</div>
<div><br></div><div>Here is my code snipped:</div><div>----------------------------------------------------------------------</div><div><div>if(mp4File->isValid())</div><div><span class="" style="white-space:pre">            </span>{</div>
<div><span class="" style="white-space:pre">                    </span>TagLib::MP4::Tag *mp4Tag = mp4File->tag();</div><div><br></div><div><span class="" style="white-space:pre">                     </span>TagLib::MP4::ItemListMap itemListMap = mp4Tag->itemListMap();</div>
<div><span class="" style="white-space:pre">                    </span>TagLib::MP4::CoverArtList coverArtList = itemListMap["covr"].toCoverArtList();</div><div><br></div><div><span class="" style="white-space:pre">                  </span>coverArtList.clear();</div>
<div><br></div><div><span class="" style="white-space:pre">                   </span>for(std::vector<EmbeddedPicture*>::iterator it = this->embeddedPictures->begin(); it != this->embeddedPictures->end(); ++it)</div><div>
<span class="" style="white-space:pre">                       </span>{</div><div><span class="" style="white-space:pre">                          </span>MP4CoverArt *mp4CoverArt = (MP4CoverArt*)*it;</div><div><span class="" style="white-space:pre">                              </span>TagLib::MP4::CoverArt coverArt(mp4CoverArt->Format(), mp4CoverArt->Data());</div>
<div><span class="" style="white-space:pre">                            </span>coverArtList.append(coverArt);</div><div><span class="" style="white-space:pre">                     </span>}</div><div><span class="" style="white-space:pre">                  </span>itemListMap.insert("covr", coverArtList);</div>
<div><br></div><div><span class="" style="white-space:pre">                   </span>mp4File->save();</div><div><span class="" style="white-space:pre">                </span>}</div></div><div>----------------------------------------------------------------------<br>
</div><div><br></div><div>The error appears as soon as the method is left. In my opinion the CoverArt object which is created and added to the ItemListMap exists on the stack and is gone when the method finishes. However creating the object on the heap by using the new operator did not help.</div>
<div><br></div><div>Do you have any ideas?</div><div><br></div><div>Cheers,</div><div>Thomas</div></div>