[vlc-devel] "equalizer-bands" corrupt/truncated occasionally

akash mehrotra mehrotra.akash at gmail.com
Fri Jun 17 20:16:03 CEST 2011


This code seems to work:

std::string s = values.toStdString();
const char *psz_values=s.c_str();

is this fine, or does it break something else?

On Fri, Jun 17, 2011 at 11:18 PM, akash mehrotra
<mehrotra.akash at gmail.com>wrote:

>
>
> 2011/6/17 Rémi Denis-Courmont <remi at remlab.net>
>
>> On Fri, 17 Jun 2011 16:09:08 +0530, akash mehrotra
>> <mehrotra.akash at gmail.com> wrote:
>> > I'm not very sure, but the corruption seems to be happening in this
>> line:
>> >     const char *psz_values = values.toAscii().constData();
>> >
>> > the length of "values" is correct till just before this, but after
>> > conversion, psz_values is often shorter than it should be
>>
>> QString::toAscii() creates a temporary anonymous object, which is garbage
>> collected at the end of the statement, is that right? I wrote many times
>> not to assign char pointers to temporary QString's...
>>
>> Yes, this line seems to be the issue, as printf("%s\n",(const char
> *)values.toAscii()); always gives the correct output.
>
> What would you suggest as a replacement?
>
>> --
>> Rémi Denis-Courmont
>> http://www.remlab.net/
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> http://mailman.videolan.org/listinfo/vlc-devel
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110617/3ba4ee1c/attachment.html>


More information about the vlc-devel mailing list