[vlc-devel] [PATCH] Fixes occasional corruption of "equalizer-bands"

Rémi Denis-Courmont remi at remlab.net
Fri Jun 17 22:24:03 CEST 2011


----- Message d'origine -----
> > diff --git a/modules/gui/qt4/components/extended_panels.cpp
> > b/modules/gui/qt4/components/extended_panels.cpp index b3f5501..d58a164 100644
> > --- a/modules/gui/qt4/components/extended_panels.cpp
> > +++ b/modules/gui/qt4/components/extended_panels.cpp
> > @@ -1060,9 +1061,10 @@ char * Equalizer::createValuesFromPreset( int i_preset )
> >          /* Create the QString in Qt */
> >          for( int i = 0 ; i< BANDS ;i++ )
> >                  values += QString( " %1" ).arg( eqz_preset_10b[i_preset]->f_amp[i] );
> > -
> > +      std::string s = values.toStdString();
> > +      const char *psz_values=s.c_str();
> >          /* Convert it to char * */
> > -      return strdup( values.toAscii().constData() );
> > +      return strdup( psz_values );
>  I don't think this one is needed as the temporary object is only destroy
> at the end of the scope (ie when strdup() has returned).

Yeah. Temporary anonymous object are scoped to the expression.

And we dont use the STL in Qt. I would use a QByteArray if an explicit object is needed/wanted.

-- 
Rémi



More information about the vlc-devel mailing list