Mercurial > dwindows
changeset 1363:cdbe26a4b116
Mingw doesn't like writing to a compile time variable in dw_menu_append_item()...
So make a temporary copy and do it there to prevent crashes.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 18 Nov 2011 19:12:20 +0000 |
parents | 412af8059331 |
children | 417866ad960b |
files | win/dw.c |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/win/dw.c Fri Nov 18 18:56:40 2011 +0000 +++ b/win/dw.c Fri Nov 18 19:12:20 2011 +0000 @@ -4933,6 +4933,7 @@ HMENU mymenu = (HMENU)menux; char buffer[31] = {0}; int is_checked, is_disabled; + char *menutitle = title; /* * Check if this is a menubar; if so get the menu object @@ -4948,7 +4949,9 @@ /* Convert from OS/2 style accellerators to Win32 style */ if (title) { - char *tmp = title; + char *tmp = menutitle = _alloca(strlen(title)+1); + + strcpy(tmp, title); while(*tmp) { @@ -4958,7 +4961,7 @@ } } - if (title && *title) + if (menutitle && *menutitle) { /* Code to autogenerate a menu ID if not specified or invalid * First pool is smaller for transient popup menus @@ -5011,8 +5014,8 @@ mii.hSubMenu = (HMENU)submenu; else mii.hSubMenu = 0; - mii.dwTypeData = title; - mii.cch = strlen(title); + mii.dwTypeData = menutitle; + mii.cch = strlen(menutitle); InsertMenuItem(mymenu, 65535, TRUE, &mii);