[MPlayer-cvslog] r36930 - trunk/gui/win32/preferences.c

ib subversion at mplayerhq.hu
Mon Feb 24 15:32:28 CET 2014


Author: ib
Date: Mon Feb 24 15:32:28 2014
New Revision: 36930

Log:
Fix bug with Win32 GUI preferences.

Determine string length in order to properly allocate memory.

Modified:
   trunk/gui/win32/preferences.c

Modified: trunk/gui/win32/preferences.c
==============================================================================
--- trunk/gui/win32/preferences.c	Mon Feb 24 15:25:53 2014	(r36929)
+++ trunk/gui/win32/preferences.c	Mon Feb 24 15:32:28 2014	(r36930)
@@ -46,7 +46,6 @@ static LRESULT CALLBACK PrefsWndProc(HWN
     HWND btn, label, edit1, edit2, updown1, updown2, track1, track2;
     static HWND vo_driver, ao_driver, prio;
     int i = 0, j = 0;
-    char procprio[11];
     float stereopos = gtkAOExtraStereoMul * 10.0;
     float delaypos = audio_delay * 10.0;
 
@@ -520,7 +519,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
                 case ID_APPLY:
                 {
                     int idx, strl;
-                    char *driver, *caption;
+                    char *driver, *procprio, *caption;
 
                     /* Set the video driver */
                     idx = SendMessage(vo_driver, CB_GETCURSEL, 0, 0);
@@ -539,8 +538,12 @@ static LRESULT CALLBACK PrefsWndProc(HWN
                     free(driver);
 
                     /* Set the priority level */
-                    SendMessage(prio, CB_GETLBTEXT, (WPARAM)SendMessage(prio, CB_GETCURSEL, 0, 0), (LPARAM)procprio);
+                    idx = SendMessage(prio, CB_GETCURSEL, 0, 0);
+                    strl = SendMessage(prio, CB_GETLBTEXTLEN, (WPARAM)idx, 0);
+                    procprio = malloc(strl + 1);
+                    SendMessage(prio, CB_GETLBTEXT, (WPARAM)idx, (LPARAM)procprio);
                     setdup(&proc_priority, procprio);
+                    free(procprio);
 
                     /* double buffering */
                     if(SendDlgItemMessage(hwnd, ID_DOUBLE, BM_GETCHECK, 0, 0) == BST_CHECKED)


More information about the MPlayer-cvslog mailing list