[MPlayer-dev-eng] [PATCH] Windows GUI with mingw64 and cygwin revised part 2

Stephen Sheldon sfsheldo at gmail.com
Thu May 5 20:00:42 CEST 2011


This patch contains the fixes for gfree and free in gui/win32.  Ingo
has already fixed gui/interface.h.  I also included the change
to use CreateThread, which allows the Windows gui to work when
compiled with Cygwin.


Index: gui/win32/interface.c
===================================================================
--- gui/win32/interface.c	(revision 33379)
+++ gui/win32/interface.c	(working copy)
@@ -22,6 +22,8 @@
  */
 
 #include <windows.h>
+#include <process.h>
+
 #include "path.h"
 #include "gui/interface.h"
 #include "m_option.h"
@@ -433,8 +435,10 @@
         guiSetDF(guiIntfStruct.Filename, dir, name);
 
     guiIntfStruct.StreamType = type;
-    free((void **) &guiIntfStruct.AudioFile);
-    free((void **) &guiIntfStruct.Subtitlename);
+    free(guiIntfStruct.AudioFile);
+    guiIntfStruct.AudioFile = NULL;
+    free(guiIntfStruct.Subtitlename);
+    guiIntfStruct.Subtitlename = NULL;
 }
 
 void mplFullScreen( void )
@@ -491,7 +495,7 @@
     /* Create The gui thread */
     if (!mygui)
     {
-        hThread = _beginthreadex(NULL, 0, GuiThread, NULL, 0, &threadId);
+        hThread = CreateThread(NULL, 0, GuiThread, NULL, 0, &threadId);
         mp_msg(MSGT_GPLAYER, MSGL_V, "[GUI] Creating GUI Thread 0x%04x\n",
threadId);
     }
 
Index: gui/win32/preferences.c
===================================================================
--- gui/win32/preferences.c	(revision 33379)
+++ gui/win32/preferences.c	(working copy)
@@ -561,14 +561,16 @@
                     if(guiIntfStruct.Playing) guiGetEvent(guiCEvent, (void
*)guiSetStop);
 
                     /* Set the video driver */
-                    gfree(video_driver_list[0]);
+                    free(video_driver_list[0]);
+                    video_driver_list[0] = NULL;
                     strl = SendMessage(vo_driver, CB_GETCURSEL, 0, 0);
                     video_driver_list[0] = malloc(strl);
                     SendMessage(vo_driver, CB_GETLBTEXT, (WPARAM)strl,
                                 (LPARAM)video_driver_list[0]);
 
                     /* Set the audio driver */
-                    gfree(audio_driver_list[0]);
+                    free(audio_driver_list[0]);
+                    audio_driver_list[0] = NULL;
                     strl = SendMessage(ao_driver, CB_GETCURSEL, 0, 0);
                     audio_driver_list[0] = malloc(strl);
                     SendMessage(ao_driver, CB_GETLBTEXT, (WPARAM)strl,
Index: gui/win32/dialogs.h
===================================================================
--- gui/win32/dialogs.h	(revision 33379)
+++ gui/win32/dialogs.h	(working copy)
@@ -34,7 +34,6 @@
 #define SOLID_GREY (HBRUSH) CreateSolidBrush(RGB(232, 232, 232))
 #define SOLID_GREY2 (HBRUSH) CreateSolidBrush(RGB(175, 175, 175))
 
-#define gfree free
 
 #define MAXFILE 1024
 




More information about the MPlayer-dev-eng mailing list