From 8f529eaeffc2ba89ce5222e1472c8314ce31e9d3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Sun, 24 Aug 2008 00:49:38 -0400 Subject: [PATCH] Do not read directory twice. This solves #1761 but this may not be the real solution. See the origin of the segfault in my comments on the trac. --- modules/gui/qt4/dialogs_provider.cpp | 8 +++++++- modules/gui/qt4/dialogs_provider.hpp | 1 + modules/gui/qt4/menus.cpp | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp index 19eeeff57f..cf4207e0bf 100644 --- a/modules/gui/qt4/dialogs_provider.cpp +++ b/modules/gui/qt4/dialogs_provider.cpp @@ -422,11 +422,17 @@ static void openDirectory( intf_thread_t *p_intf, bool pl, bool go ) playlist_AddInput( THEPL, p_input, go ? ( PLAYLIST_APPEND | PLAYLIST_GO ) : PLAYLIST_APPEND, PLAYLIST_END, pl, pl_Unlocked ); - input_Read( THEPL, p_input, false ); + if( !go ) + input_Read( THEPL, p_input, false ); vlc_gc_decref( p_input ); } } +void DialogsProvider::PLOpenDir() +{ + openDirectory( p_intf, true, true ); +} + void DialogsProvider::PLAppendDir() { openDirectory( p_intf, true, false ); diff --git a/modules/gui/qt4/dialogs_provider.hpp b/modules/gui/qt4/dialogs_provider.hpp index d1547b2048..d86e24eea4 100644 --- a/modules/gui/qt4/dialogs_provider.hpp +++ b/modules/gui/qt4/dialogs_provider.hpp @@ -166,6 +166,7 @@ public slots: void PLAppendDialog(); void MLAppendDialog(); + void PLOpenDir(); void PLAppendDir(); void MLAppendDir(); diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp index 228086154e..35ebb977b6 100644 --- a/modules/gui/qt4/menus.cpp +++ b/modules/gui/qt4/menus.cpp @@ -289,7 +289,7 @@ QMenu *QVLCMenu::FileMenu() addDPStaticEntry( menu, qtr( "&Open File..." ), "", ":/file-asym", SLOT( openFileDialog() ), "Ctrl+O" ); addDPStaticEntry( menu, qtr( I_OPEN_FOLDER ), "", - ":/folder-grey", SLOT( PLAppendDir() ), "Ctrl+F" ); + ":/folder-grey", SLOT( PLOpenDir() ), "Ctrl+F" ); addDPStaticEntry( menu, qtr( "Open &Disc..." ), "", ":/disc", SLOT( openDiscDialog() ), "Ctrl+D" ); addDPStaticEntry( menu, qtr( "Open &Network..." ), "", @@ -677,7 +677,7 @@ void QVLCMenu::PopupMenuStaticEntries( intf_thread_t *p_intf, QMenu *menu ) addDPStaticEntry( openmenu, qtr( "&Open File..." ), "", ":/file-asym", SLOT( openFileDialog() ) ); addDPStaticEntry( openmenu, qtr( I_OPEN_FOLDER ), "", - ":/folder-grey", SLOT( PLAppendDir() ) ); + ":/folder-grey", SLOT( PLOpenDir() ) ); addDPStaticEntry( openmenu, qtr( "Open &Disc..." ), "", ":/disc", SLOT( openDiscDialog() ) ); addDPStaticEntry( openmenu, qtr( "Open &Network..." ), "", -- 2.39.2