Mercurial > mplayer.hg
changeset 33770:6134493605c6
Use macro nfree() in Win32 GUI code.
author | ib |
---|---|
date | Sat, 09 Jul 2011 11:11:52 +0000 |
parents | fd05ddb85f03 |
children | 6e774a02d00c |
files | gui/win32/gui.c gui/win32/interface.c gui/win32/skinload.c |
diffstat | 3 files changed, 21 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/win32/gui.c Sat Jul 09 10:39:33 2011 +0000 +++ b/gui/win32/gui.c Sat Jul 09 11:11:52 2011 +0000 @@ -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 @@ 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 */
--- a/gui/win32/interface.c Sat Jul 09 10:39:33 2011 +0000 +++ b/gui/win32/interface.c Sat Jul 09 11:11:52 2011 +0000 @@ -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 @@ 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 @@ 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 @@ case MP_CMD_QUIT: { mygui->uninit(mygui); - free(mygui); - mygui = NULL; + nfree(mygui); exit_player(EXIT_QUIT); return 1; }
--- a/gui/win32/skinload.c Sat Jul 09 10:39:33 2011 +0000 +++ b/gui/win32/skinload.c Sat Jul 09 11:11:52 2011 +0000 @@ -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 @@ { 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]); + + nfree(skin->fonts[i]->chars); - free(skin->fonts[i]->chars); - skin->fonts[i]->chars = NULL; - - 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 @@ if(skin->widgets[i]->id == id) { free(skin->widgets[i]->label); - free(skin->widgets[i]); - skin->widgets[i] = NULL; + nfree(skin->widgets[i]); } else {