[MPlayer-cvslog] r33858 - in trunk/gui/win32: gui.c interface.c skinload.c

ib subversion at mplayerhq.hu
Sat Jul 9 13:11:52 CEST 2011


Author: ib
Date: Sat Jul  9 13:11:52 2011
New Revision: 33858

Log:
Use macro nfree() in Win32 GUI code.

Modified:
   trunk/gui/win32/gui.c
   trunk/gui/win32/interface.c
   trunk/gui/win32/skinload.c

Modified: trunk/gui/win32/gui.c
==============================================================================
--- trunk/gui/win32/gui.c	Sat Jul  9 12:39:33 2011	(r33857)
+++ trunk/gui/win32/gui.c	Sat Jul  9 13:11:52 2011	(r33858)
@@ -43,6 +43,7 @@
 #include "gui/interface.h"
 #include "gui/ui/actions.h"
 #include "gui/ui/gmplayer.h"
+#include "gui/util/mem.h"
 #include "gui.h"
 #include "dialogs.h"
 
@@ -1118,8 +1119,7 @@ int destroy_window(gui_t *gui)
             DeleteObject(gui->window_priv[i]->bitmap);
         free(gui->window_priv[i]);
     }
-    free(gui->window_priv);
-    gui->window_priv = NULL;
+    nfree(gui->window_priv);
     gui->window_priv_count = 0;
 
     /* destroy the main window */

Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c	Sat Jul  9 12:39:33 2011	(r33857)
+++ trunk/gui/win32/interface.c	Sat Jul  9 13:11:52 2011	(r33858)
@@ -50,6 +50,7 @@
 #include "libmpcodecs/dec_audio.h"
 #include "gui/ui/actions.h"
 #include "gui/ui/gmplayer.h"
+#include "gui/util/mem.h"
 #include "gui/util/list.h"
 #include "gui/util/string.h"
 #include "mp_core.h"
@@ -409,10 +410,8 @@ void uiSetFileName(char *dir, char *name
         setddup(&guiInfo.Filename, dir, name);
 
     guiInfo.StreamType = type;
-    free(guiInfo.AudioFile);
-    guiInfo.AudioFile = NULL;
-    free(guiInfo.Subtitlename);
-    guiInfo.Subtitlename = NULL;
+    nfree(guiInfo.AudioFile);
+    nfree(guiInfo.Subtitlename);
 }
 
 void uiFullScreen( void )
@@ -488,8 +487,7 @@ void guiDone(void)
         WaitForSingleObject(hThread, INFINITE);
         CloseHandle(hThread);
         mygui->uninit(mygui);
-        free(mygui);
-        mygui = NULL;
+        nfree(mygui);
     }
     /* Remove tray icon */
     Shell_NotifyIcon(NIM_DELETE, &nid);
@@ -651,8 +649,7 @@ int gui(int what, void *arg)
                 case MP_CMD_QUIT:
                 {
                     mygui->uninit(mygui);
-                    free(mygui);
-                    mygui = NULL;
+                    nfree(mygui);
                     exit_player(EXIT_QUIT);
                     return 1;
                 }

Modified: trunk/gui/win32/skinload.c
==============================================================================
--- trunk/gui/win32/skinload.c	Sat Jul  9 12:39:33 2011	(r33857)
+++ trunk/gui/win32/skinload.c	Sat Jul  9 13:11:52 2011	(r33858)
@@ -32,6 +32,7 @@
 #include "libswscale/swscale.h"
 #include "libavutil/imgutils.h"
 #include "gui.h"
+#include "gui/util/mem.h"
 #include "gui/util/bitmap.h"
 
 #define MAX_LINESIZE 256
@@ -218,55 +219,41 @@ static void freeskin(skin_t *skin)
 {
     unsigned int i;
 
-    free(skin->skindir);
-    skin->skindir = NULL;
+    nfree(skin->skindir);
 
     for (i=1; i<=skin->lastusedid; i++)
         skin->removewidget(skin, i);
 
-    free(skin->widgets);
-    skin->widgets = NULL;
+    nfree(skin->widgets);
 
     freeimages(skin);
     for(i=0; i<skin->windowcount; i++)
     {
-        free(skin->windows[i]->name);
-        skin->windows[i]->name = NULL;
+        nfree(skin->windows[i]->name);
         free(skin->windows[i]);
     }
 
-    free(skin->windows);
-    skin->windows = NULL;
+    nfree(skin->windows);
 
     for (i=0; i<skin->fontcount; i++)
     {
         unsigned int x;
 
-        free(skin->fonts[i]->name);
-        skin->fonts[i]->name = NULL;
-
-        free(skin->fonts[i]->id);
-        skin->fonts[i]->id = NULL;
+        nfree(skin->fonts[i]->name);
+        nfree(skin->fonts[i]->id);
 
         for (x=0; x<skin->fonts[i]->charcount; x++)
-        {
-            free(skin->fonts[i]->chars[x]);
-            skin->fonts[i]->chars[x] = NULL;
-        }
+            nfree(skin->fonts[i]->chars[x]);
 
-        free(skin->fonts[i]->chars);
-        skin->fonts[i]->chars = NULL;
+        nfree(skin->fonts[i]->chars);
 
-        free(skin->fonts[i]);
-        skin->fonts[i] = NULL;
+        nfree(skin->fonts[i]);
     }
-    free(skin->fonts);
-    skin->fonts = NULL;
+    nfree(skin->fonts);
 #ifdef DEBUG
     mp_msg(MSGT_GPLAYER, MSGL_DBG4, "[SKIN FREE] skin freed\n");
 #endif
-    free(skin);
-    skin = NULL;
+    nfree(skin);
 }
 
 static void removewidget(skin_t *skin, int id)
@@ -280,8 +267,7 @@ static void removewidget(skin_t *skin, i
         if(skin->widgets[i]->id == id)
         {
             free(skin->widgets[i]->label);
-            free(skin->widgets[i]);
-            skin->widgets[i] = NULL;
+            nfree(skin->widgets[i]);
         }
         else
         {


More information about the MPlayer-cvslog mailing list