commit 9ad28b14463065add765ed7f1e4b288263b570ce
Author: phantomjinx <p.g.richard...@phantomjinx.co.uk>
Date:   Mon Feb 21 12:20:13 2011 +0000

    Fix for crash when deleting a repository
    
    * Freeing the dead itdbs too early creates a segfault in the playlist and
      repository combobox images.
    
    * Re init the comboboxes then free the dead itdbs

 plugins/repository_editor/repository_editor.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/plugins/repository_editor/repository_editor.c 
b/plugins/repository_editor/repository_editor.c
index 6a7ab55..29ef194 100644
--- a/plugins/repository_editor/repository_editor.c
+++ b/plugins/repository_editor/repository_editor.c
@@ -691,6 +691,8 @@ static void new_repository_button_clicked(GtkButton 
*button) {
 static void edit_apply_clicked(GtkButton *button) {
     gint i, itdb_num, del_num;
     struct itdbs_head *itdbs_head;
+    GList *deaditdbs = NULL;
+    GList *gl = NULL;
 
     g_return_if_fail (repository_view);
 
@@ -736,7 +738,7 @@ static void edit_apply_clicked(GtkButton *button) {
 
                 itdb = g_list_nth_data(itdbs_head->itdbs, i - del_num);
                 gp_itdb_remove(itdb);
-                gp_itdb_free(itdb);
+                deaditdbs = g_list_append(deaditdbs, itdb);
 
                 /* keep itdb_index of currently displayed repository
                  updated in case we need to select a new one */
@@ -815,6 +817,16 @@ static void edit_apply_clicked(GtkButton *button) {
 #   endif
 
     update_buttons(repository_view);
+
+    /*
+     * Free the deleted itdbs. Need to do this at the end
+     * due to the combo boxes having to be re-initialised first.
+     */
+    for (gl = deaditdbs; gl; gl = gl->next) {
+        gp_itdb_free(gl->data);
+    }
+    gl = NULL;
+    g_list_free(deaditdbs);
 }
 
 static void ipod_sync_button_clicked(iPodSyncType type) {

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
gtkpod-cvs2 mailing list
gtkpod-cvs2@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to