From bbc47e96d32b3594dd4fc6eef616d725a8bd75e5 Mon Sep 17 00:00:00 2001 From: Andrea Weikert Date: Tue, 4 Sep 2007 20:27:43 +0000 Subject: == imagebrowser == - fix: deleting bookmark didn't update .Bfs file (see tracker #7298) - also fixed memleak, thanks to the guardedalloc :) --- source/blender/src/editimasel.c | 19 +++++++++++-------- source/blender/src/fsmenu.c | 31 ++++++++++++++----------------- 2 files changed, 25 insertions(+), 25 deletions(-) (limited to 'source/blender/src') diff --git a/source/blender/src/editimasel.c b/source/blender/src/editimasel.c index 506dadfe6bd..6111329e3e7 100644 --- a/source/blender/src/editimasel.c +++ b/source/blender/src/editimasel.c @@ -1058,15 +1058,18 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt) case XKEY: getmouseco_areawin(mval); if (simasel->flag & FILE_BOOKMARKS) { - if(mval[0]>simasel->bookmarkrect.xmin && mval[0]bookmarkrect.xmax && mval[1]>simasel->bookmarkrect.ymin && mval[1]bookmarkrect.ymax) { - int nentries = fsmenu_get_nentries(); - set_active_bookmark(simasel, mval[1]); - if (simasel->active_bookmark >= 0 && simasel->active_bookmark < nentries) { - fsmenu_remove_entry(simasel->active_bookmark); - simasel->active_bookmark = -1; - do_draw = 1; - } + if(mval[0]>simasel->bookmarkrect.xmin && mval[0]bookmarkrect.xmax && mval[1]>simasel->bookmarkrect.ymin && mval[1]bookmarkrect.ymax) { + int nentries = fsmenu_get_nentries(); + set_active_bookmark(simasel, mval[1]); + if (simasel->active_bookmark >= 0 && simasel->active_bookmark < nentries) { + char name[FILE_MAX]; + BLI_make_file_string(G.sce, name, BLI_gethome(), ".Bfs"); + fsmenu_remove_entry(simasel->active_bookmark); + fsmenu_write_file(name); + simasel->active_bookmark = -1; + do_draw = 1; } + } } break; } diff --git a/source/blender/src/fsmenu.c b/source/blender/src/fsmenu.c index 1d03291b135..11c0bb6a96e 100644 --- a/source/blender/src/fsmenu.c +++ b/source/blender/src/fsmenu.c @@ -206,24 +206,21 @@ void fsmenu_remove_entry(int idx) idx--; if (fsme) { - if (prev) { - prev->next= fsme->next; - } else { - fsmenu= fsme->next; - if (fsme->save) { - if (prev) { - prev->next= fsme->next; - } else { - fsmenu= fsme->next; - } - // you should only be able to remove entries that were - // not added by default - if (fsme->path) { - MEM_freeN(fsme->path); - } - MEM_freeN(fsme); + /* you should only be able to remove entries that were + not added by default, like windows drives. + also separators (where path == NULL) shouldn't be removed */ + if (fsme->save && fsme->path) { + + /* remove fsme from list */ + if (prev) { + prev->next= fsme->next; + } else { + fsmenu= fsme->next; } - } + /* free entry */ + MEM_freeN(fsme->path); + MEM_freeN(fsme); + } } } -- cgit v1.2.3