changeset 33265:62c0471bcf8c

Free config. It isn't freed so far.
author ib
date Tue, 03 May 2011 13:19:39 +0000
parents 284fc94290b9
children de4f5f183ddb
files gui/cfg.c gui/cfg.h gui/interface.c
diffstat 3 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gui/cfg.c	Tue May 03 12:21:11 2011 +0000
+++ b/gui/cfg.c	Tue May 03 13:19:39 2011 +0000
@@ -28,7 +28,6 @@
 #include "libmpcodecs/vd.h"
 #include "libvo/video_out.h"
 #include "libvo/x11_common.h"
-#include "m_config.h"
 #include "m_option.h"
 #include "mixer.h"
 #include "mp_msg.h"
@@ -39,6 +38,8 @@
 #include "sub/font_load.h"
 #include "sub/sub.h"
 
+m_config_t *gui_conf;
+
 int gtkCacheOn;
 int gtkCacheSize = 2048;
 
@@ -96,8 +97,6 @@
 int gui_sub_pos_x  = -3;
 int gui_sub_pos_y  = -3;
 
-static m_config_t *gui_conf;
-
 static const m_option_t gui_opts[] = {
     { "cache",                       &gtkCacheOn,              CONF_TYPE_FLAG,        0,          0,     1,       NULL },
     { "cache_size",                  &gtkCacheSize,            CONF_TYPE_INT,         CONF_RANGE, 32,    1048576, NULL },
--- a/gui/cfg.h	Tue May 03 12:21:11 2011 +0000
+++ b/gui/cfg.h	Tue May 03 13:19:39 2011 +0000
@@ -19,6 +19,10 @@
 #ifndef MPLAYER_GUI_CFG_H
 #define MPLAYER_GUI_CFG_H
 
+#include "m_config.h"
+
+extern m_config_t *gui_conf;
+
 extern int gtkCacheOn;
 extern int gtkCacheSize;
 
--- a/gui/interface.c	Tue May 03 12:21:11 2011 +0000
+++ b/gui/interface.c	Tue May 03 13:19:39 2011 +0000
@@ -72,6 +72,8 @@
 
 float gtkEquChannels[6][10];
 
+static int initialized;
+
 int gstrcmp(const char *a, const char *b)
 {
     if (!a && !b)
@@ -379,6 +381,8 @@
         guiSetFilename(guiIntfStruct.Subtitlename, subdata->filename);
 
     guiLoadFont();
+
+    initialized = 1;
 }
 
 void guiDone(void)
@@ -417,6 +421,13 @@
 // GUI's own abortions during (and before) guiInit().
 void guiExit(int how)
 {
+    if (!initialized || (how == DONE)) {
+        if (gui_conf) {
+            m_config_free(gui_conf);
+            gui_conf = NULL;
+        }
+    }
+
     if (how != DONE)
         exit_player(how);
 }