Skip to content

Commit 408bafe

Browse files
author
jan.nijtmans
committed
Windows build is broken, this hopefully fixes it, see [e770378a5ba56ca2]
1 parent ed54098 commit 408bafe

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

win/tkWinMenu.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -572,13 +572,11 @@ ReconfigureWindowsMenu(
572572
TkMenu *menuPtr = (TkMenu *)clientData;
573573
TkMenuEntry *mePtr;
574574
HMENU winMenuHdl = (HMENU) menuPtr->platformData;
575-
char *itemText = NULL;
576575
LPCWSTR lpNewItem;
577576
UINT flags;
578577
UINT itemID;
579578
Tcl_Size i, count;
580579
int systemMenu = 0, base;
581-
Tcl_DString translatedText;
582580
MENUITEMINFOW itemInfo;
583581

584582
if (NULL == winMenuHdl) {
@@ -598,6 +596,9 @@ ReconfigureWindowsMenu(
598596

599597
count = menuPtr->numEntries;
600598
for (i = 0; i < count; i++) {
599+
char *itemText = NULL;
600+
Tcl_DString translatedText;
601+
601602
mePtr = menuPtr->entries[i];
602603
lpNewItem = NULL;
603604
flags = MF_BYPOSITION;
@@ -611,7 +612,6 @@ ReconfigureWindowsMenu(
611612
itemText = GetEntryText(menuPtr, mePtr);
612613
if ((menuPtr->menuType == MENUBAR)
613614
|| (menuPtr->menuFlags & MENU_SYSTEM_MENU)) {
614-
Tcl_DStringInit(&translatedText);
615615
Tcl_UtfToWCharDString(itemText, TCL_INDEX_NONE, &translatedText);
616616
lpNewItem = (LPCWSTR) Tcl_DStringValue(&translatedText);
617617
flags |= MF_STRING;
@@ -744,14 +744,12 @@ ReconfigureWindowsMenu(
744744

745745
Tcl_DStringFree(&accessText);
746746
}
747+
Tcl_DStringFree(&translatedText);
748+
if (itemText != NULL) {
749+
ckfree(itemText);
750+
itemText = NULL;
751+
}
747752
}
748-
749-
Tcl_DStringFree(&translatedText);
750-
if (itemText != NULL) {
751-
ckfree(itemText);
752-
itemText = NULL;
753-
}
754-
755753

756754
if ((menuPtr->menuType == MENUBAR)
757755
&& (menuPtr->parentTopLevelPtr != NULL)) {

0 commit comments

Comments
 (0)