changeset 36719:9ba7cfbe20c9

Fix usage of acp(). A call to acp() frees the previous string it has allocated which means that there must not be two acp() calls as arguments to a function. Based on a patch by Stephen Sheldon, sfsheldo gmail com.
author ib
date Sat, 08 Feb 2014 21:41:48 +0000
parents bcc482b14d39
children 962e2f41a08e
files gui/win32/preferences.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui/win32/preferences.c	Sat Feb 08 20:41:35 2014 +0000
+++ b/gui/win32/preferences.c	Sat Feb 08 21:41:48 2014 +0000
@@ -543,6 +543,8 @@
                 case ID_APPLY:
                 {
                     int strl;
+                    char *caption;
+
                     if(guiInfo.Playing) gui(GUI_SET_STATE, (void *)GUI_STOP);
 
                     /* Set the video driver */
@@ -632,7 +634,9 @@
                     else if(SendDlgItemMessage(hwnd, ID_OSD3, BM_GETCHECK, 0, 0) == BST_CHECKED)
                         osd_level = 3;
 
-                    MessageBox(hwnd, acp(MSGTR_GUI_MSG_PlaybackNeedsRestart), acp(MSGTR_GUI_Warning), MB_OK);
+                    caption = strdup(acp(MSGTR_GUI_Warning));
+                    MessageBox(hwnd, acp(MSGTR_GUI_MSG_PlaybackNeedsRestart), caption, MB_OK);
+                    free(caption);
                     DestroyWindow(hwnd);
                     break;
                 }