[prev in list] [next in list] [prev in thread] [next in thread] 

List:       taglib-devel
Subject:    Re: 1.9.1 valid tag in debug, crash in release.
From:       Yogesh Marwaha <yogeshm.007 () gmail ! com>
Date:       2013-10-29 13:48:31
Message-ID: CA+r9wRF0xS5qA74md3oCbi8vW5tNaxKVOWMjoCP+5UKBBeOcoQ () mail ! gmail ! com
[Download RAW message or body]

On 29 October 2013 03:25, Festus Hagen <festushagenlists@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
http://harmattan-dev.nokia.com/docs/library/html/qt4/qbytearray.html?tab=3&q=QByteArray#data

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());
OR
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)

Regards,

-- 
Yogesh Marwaha
_______________________________________________
taglib-devel mailing list
taglib-devel@kde.org
https://mail.kde.org/mailman/listinfo/taglib-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic