1.9.1 valid tag in debug, crash in release.

Festus Hagen festushagenlists at yahoo.com
Wed Oct 30 02:44:11 UTC 2013

Yup, I've read about this issue, though I do believe that is also where I got the code: path.toLocal8Bit().constData() with the understanding that it did not have the same issue. I may be incorrect. Though I have had no issues since changing to it's use.

Yes, the QByteArray a = path ... method is another, it was the method used to demo the issue or lack there of with it's use.

I've had a lot of trouble going from Qt to TagLib, TagLib to Qt has been easy. I attribute my difficulty to lack of coding skills.

fh : )_~

----- Original Message -----

From: Yogesh Marwaha <yogeshm.007 at gmail.com>
To: Festus Hagen <festushagenlists at yahoo.com>; taglib-devel at kde.org
Sent: Tuesday, October 29, 2013 9:48 AM
Subject: Re: 1.9.1 valid tag in debug, crash in release.

On 29 October 2013 03:25, Festus Hagen <festushagenlists at yahoo.com> wrote:
>         const TagLib::FileRef f( reinterpret_cast<const wchar_t*>(path.utf16()) );
> Or
>         const TagLib::FileRef f(path.toUtf8().data());
> Work reliably for me, I am on WinXP using Qt5.
> I use:
>         const TagLib::MPEG::File f(path.toLocal8Bit().constData());

Well, I think I've been through this mud before. Though I have been
out of touch for long, it seems the problem lies in

const TagLib::FileRef f(path.toUtf8().data());

Here path.toUtf8() creates a QByteArray which is (as per my
knowledge/or lack thereof) deleted as soon as it goes out of scope.

So, following my theory, any success with
const TagLib::FileRef f(path.toUtf8().data());

const TagLib::MPEG::File f(path.toLocal8Bit().constData());
is a matter of chance.

You can try by, e.g.:
QByteArray a = path.toUtf8(); OR path.toLocal8Bit()
const TagLib::MPEG::File f(a.constData()); OR a.data();

Please correct me if I'm wrong. (I've not practically tried this)


Yogesh Marwaha

More information about the taglib-devel mailing list