[vlc-devel] commit: Qt4|Bookmarks: fix memleaks. ( Rémi Duraffort )
git version control
git at videolan.org
Thu Oct 30 20:59:53 CET 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Thu Oct 30 20:57:30 2008 +0100| [691503a29d3b860b4c4428f316b8f0ef56dd7013] | committer: Rémi Duraffort
Qt4|Bookmarks: fix memleaks.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=691503a29d3b860b4c4428f316b8f0ef56dd7013
---
modules/gui/qt4/dialogs/bookmarks.cpp | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/modules/gui/qt4/dialogs/bookmarks.cpp b/modules/gui/qt4/dialogs/bookmarks.cpp
index b64b53c..7910110 100644
--- a/modules/gui/qt4/dialogs/bookmarks.cpp
+++ b/modules/gui/qt4/dialogs/bookmarks.cpp
@@ -189,13 +189,15 @@ void BookmarksDialog::edit( QTreeWidgetItem *item, int column )
return;
input_thread_t *p_input = THEMIM->getInput();
- if( !p_input ) return;
+ if( !p_input )
+ return;
// We get the row number of the item
int i_edit = bookmarksList->indexOfTopLevelItem( item );
// We get the bookmarks list
- seekpoint_t **pp_bookmarks;
+ seekpoint_t** pp_bookmarks;
+ seekpoint_t* p_seekpoint;
int i_bookmarks;
if( input_Control( p_input, INPUT_GET_BOOKMARKS, &pp_bookmarks,
@@ -206,20 +208,30 @@ void BookmarksDialog::edit( QTreeWidgetItem *item, int column )
return;
// We modify the seekpoint
- seekpoint_t *p_seekpoint = pp_bookmarks[i_edit];
+ p_seekpoint = pp_bookmarks[i_edit];
if( column == 0 )
+ {
+ free( p_seekpoint->psz_name );
p_seekpoint->psz_name = strdup( qtu( item->text( column ) ) );
+ }
else if( column == 1 )
p_seekpoint->i_byte_offset = atoi( qtu( item->text( column ) ) );
else if( column == 2 )
p_seekpoint->i_time_offset = 1000000 * atoll( qtu( item->text( column ) ) );
+ // Send the modification
if( input_Control( p_input, INPUT_CHANGE_BOOKMARK, p_seekpoint, i_edit ) !=
VLC_SUCCESS )
- return;
+ goto clear;
+ // Everything goes fine : update
update();
+// Clear the bookmark list
+clear:
+ for( int i = 0; i < i_bookmarks; i++)
+ vlc_seekpoint_Delete( pp_bookmarks[i] );
+ free( pp_bookmarks );
}
void BookmarksDialog::extract()
More information about the vlc-devel
mailing list