changeset 33781:cdd4fc0616b6

Fix memory leak in the Win32 GUI. Use global config variable skinName which has been set prior to the call of create_gui(), don't pass it.
author ib
date Mon, 11 Jul 2011 10:36:09 +0000
parents 04b4fa214c2a
children 896b427e598e
files gui/win32/gui.c gui/win32/gui.h gui/win32/interface.c
diffstat 3 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/gui/win32/gui.c	Sun Jul 10 15:45:18 2011 +0000
+++ b/gui/win32/gui.c	Mon Jul 11 10:36:09 2011 +0000
@@ -1520,7 +1520,7 @@
     return 0;
 }
 
-gui_t *create_gui(char *skindir, char *skinName, void (*playercontrol)(int event))
+gui_t *create_gui(char *skindir, void (*playercontrol)(int event))
 {
     gui_t *gui = calloc(1, sizeof(gui_t));
     char temp[MAX_PATH];
@@ -1540,7 +1540,6 @@
     /* create playlist */
     gui->playlist = create_playlist();
 
-    if(!skinName) skinName = strdup("Blue");
     sprintf(temp, "%s\\%s", skindir, skinName);
     if(create_window(gui, temp)) return NULL;
     if(create_subwindow(gui, temp)) return NULL;
--- a/gui/win32/gui.h	Sun Jul 10 15:45:18 2011 +0000
+++ b/gui/win32/gui.h	Mon Jul 11 10:36:09 2011 +0000
@@ -98,7 +98,7 @@
 #define     wsMovable       2
 #define     wsSizeable      4
 
-gui_t *create_gui(char *skindir, char *skinName, void (*playercontrol)(int event));
+gui_t *create_gui(char *skindir, void (*playercontrol)(int event));
 int destroy_window(gui_t *gui);
 int create_window(gui_t *gui, char *skindir);
 int create_subwindow(gui_t *gui, char *skindir);
--- a/gui/win32/interface.c	Sun Jul 10 15:45:18 2011 +0000
+++ b/gui/win32/interface.c	Mon Jul 11 10:36:09 2011 +0000
@@ -377,7 +377,7 @@
     MSG msg;
 
     if(!skinName) skinName = strdup("Blue");
-    if(!mygui) mygui = create_gui(get_path("skins"), skinName, guiSetEvent);
+    if(!mygui) mygui = create_gui(get_path("skins"), guiSetEvent);
     if(!mygui) exit_player(EXIT_ERROR);
 
     if(autosync && autosync != gtkAutoSync)