[vlc-commits] Qt4: never assign qtu() to a variable
Rémi Denis-Courmont
git at videolan.org
Sat Jun 18 11:59:55 CEST 2011
vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 18 12:53:35 2011 +0300| [0259254ca63344f2b94fbc0e153c332c9a65f54d] | 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.
(cherry picked from commit 41c3dd9b229c44cb313786f96cc2089a9d5197cc)
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=0259254ca63344f2b94fbc0e153c332c9a65f54d
---
.../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 6534868..d19f523 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -883,9 +883,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