[vlc-commits] Qt4: never assign qtu() to a variable
Rémi Denis-Courmont
git at videolan.org
Sat Jun 18 11:58:33 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 18 12:53:35 2011 +0300| [41c3dd9b229c44cb313786f96cc2089a9d5197cc] | committer: Rémi Denis-Courmont
Qt4: never assign qtu() to a variable
As far as I understand, this breaks C++ object scoping. qtu() creates
a temporary anonymous QByteArray from its QString parameter. That array
is destroyed at the end of the expression, thus the return value of
qtu() becomes a dangling pointer.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=41c3dd9b229c44cb313786f96cc2089a9d5197cc
---
.../gui/qt4/components/playlist/playlist_model.cpp | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index ebec0bb..6d5d0c3 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -854,9 +854,8 @@ void PLModel::search( const QString& search_text, const QModelIndex & idx, bool
playlist_item_t *p_root = playlist_ItemGetById( p_playlist,
itemId( idx ) );
assert( p_root );
- const char *psz_name = qtu( search_text );
- playlist_LiveSearchUpdate( p_playlist , p_root, psz_name, b_recursive );
-
+ playlist_LiveSearchUpdate( p_playlist , p_root, qtu( search_text ),
+ b_recursive );
if( idx.isValid() )
{
PLItem *searchRoot = getItem( idx );
More information about the vlc-commits
mailing list