TagLib::MPEG::File destructor not happy?

Scott Wheeler wheeler at kde.org
Thu Apr 20 22:36:57 CEST 2006

On Friday 07 April 2006 6:56, Dave Wiard wrote:
> I've been trying to figure out how to get ahold of some ID3v2 tags that
> are not accessible via the high-level "get" functions. I've been pouring
> over the online doc and so far this chunk of code is the only one I've
> seen that looks right:
>  TagLib::MPEG::File f("foo.mp3");
>  if(f.ID3v2Tag()) {
>    TagLib::ID3v2::FrameList l = f.ID3v2Tag()->frameListMap()["TBPM"];
>    if(!l.isEmpty())
>      std::cout << l.front().toString() << std::endl;
>  }
> I took this directly from the online doc. I'm running version 1.4 and I
> have two problems:
> 1) This code does not compile. The compiler does not like .toString().

That's just a typo in the docs -- it should be ->toString() instead.  (I've 
just fixed it in the docs as well.)

> 2) This code, when incorporated into my Qt app with only three changes
> (TBPM -> TALB, truncate .toString(), and load my own file not foo.mp3),
> generates the abort below (I think) when "f" is destroyed as the code
> passes out of scope.

It's not really possible to say just from what you typed what exactly the 
problem is.  But it is correct that you cannot continue to use structures 
that are part of the file once the file has passed out of scope...

gdb and valgrind usually provide lots of useful information.


diff -u life.cpp~ life.cpp
--- life.cpp~   2002/03/19 07:44:28
+++ life.cpp   2002/04/09 15:49:39
-#include <sleep.h>
+#include <caffeine.h>

More information about the taglib-devel mailing list