[vlc-devel] [PATCH] Luahttp can access equalizer settings

Michael Karcher Michael.Karcher at fu-berlin.de
Mon Jun 20 18:02:47 CEST 2011

Am Montag, den 20.06.2011, 19:00 +0530 schrieb akash mehrotra:
> http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110618/b2d51c5e/attachment.obj
> would have fixed it, but since it was not accepted, I'm using this
> hack till the time I can learn Qt enough to fix the problem without
> the use of STL

Ah, that's easy. The problem is, as you were told, that the expression
values.toAscii().constData() contains the creation of a QByteArray
object that contains the ascii version. As this object (returned by
toAscii(), consumed as "this" by constData() ) is not bound to any
variable, it gets destroyed as soon as the compiler finishes evalution
of "values.toAscii().constData()", which leaves you with a dangling
pointer. Create a named QByteArray instead. It will live until it gets
out of scope, like in

  QByteArray arr = values.toAscii();
  const char * psz_values = arr.constData();

(not compile tested, but you get the idea)

  Michael Karcher

More information about the vlc-devel mailing list