Tk Source Code

View Ticket
Login
Ticket UUID: 3464070
Title: MenuNewEntry() return NULL -> no error msg
Type: Bug Version: 8.6.18, 9.0.5, 9.1.0
Submitter: dgp Created on: 2011-12-22 18:27:47
Subsystem: 10. Generic Menus Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-10-30 13:39:41
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-10-30 13:39:41
Description:
Noticed when reviewing 3235356, 3460976.

In the rare case when a new menu entry cannot
be created, the TCL_ERROR returned by various
menu commands is not accompanied by any error
message, code, etc.
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-10-30 13:39:41:

Merged by Jan into main and core-9-0-branch by commits [1512c574] and [7fef988d ]. Backported to core-8-6-branch by commit [6db26499]. Closing the ticket.


jan.nijtmans added on 2026-10-30 13:36:44:

Fixed on [1512c574|trunk], core-9-0-branch and core-8-6-branch (thanks @scaba for doing the last one)

Many thanks!


serhiy.storchaka added on 2026-10-25 07:57:48:

The only case without a message is on Windows, when all menu command IDs are in use. On that path MenuNewEntry() also frees the new entry but leaves it in the menu, so using or destroying the menu later crashes. Fixed on branch menu-new-entry-error [18d8a385e1]: the slot is removed again, and the error is "No more menu entries can be allocated." with error code TK MENU SYSTEM_RESOURCES, as for the existing CreatePopupMenu() failure. New test winMenu-36.1. Tested on Linux and Windows; not tested on macOS.