diff options
author | wm4 <wm4@nowhere> | 2014-08-07 00:35:38 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-08-07 00:35:38 +0200 |
commit | 483595e2d44fa75a6beab3030c0edbbf5ff813a4 (patch) | |
tree | 63d49c89dc823774ffe4b98bcdd9984ff640bdac /DOCS/client_api_examples | |
parent | 1483fd443a70150204bea3067749a94358f32c22 (diff) | |
download | mpv-483595e2d44fa75a6beab3030c0edbbf5ff813a4.tar.bz2 mpv-483595e2d44fa75a6beab3030c0edbbf5ff813a4.tar.xz |
client API: qtexample: don't pass deallocated strings to mpv
The temporary QByteArray is deallocated already at the end of the
statement in C++, instead of the end of the scope (like in C).
Diffstat (limited to 'DOCS/client_api_examples')
-rw-r--r-- | DOCS/client_api_examples/qtexample.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/DOCS/client_api_examples/qtexample.cpp b/DOCS/client_api_examples/qtexample.cpp index b23d2fa891..354e5d9a34 100644 --- a/DOCS/client_api_examples/qtexample.cpp +++ b/DOCS/client_api_examples/qtexample.cpp @@ -114,7 +114,8 @@ void MainWindow::on_file_open() { QString filename = QFileDialog::getOpenFileName(this, "Open file"); if (mpv) { - const char *args[] = {"loadfile", filename.toUtf8().data(), NULL}; + const QByteArray c_filename = filename.toUtf8(); + const char *args[] = {"loadfile", c_filename.data(), NULL}; mpv_command_async(mpv, 0, args); } } |