Tk Source Code

View Ticket
Login
2026-10-30
13:39 • Ticket [3464070f] MenuNewEntry() return NULL -> no error msg status still Closed with 7 other changes artifact: 46054ef3 user: nemethi
13:36 • Closed ticket [3464070f]. artifact: d52d7802 user: jan.nijtmans
12:47
Fix [346407]: Missing error-handling when MenuNewEntry() returns NULL check-in: 6db26499 user: csaba tags: core-8-6-branch
2026-10-26
21:19
Fix [346407]: Missing error-handling when MenuNewEntry() returns NULL check-in: 7fef988d user: jan.nijtmans tags: core-9-0-branch
21:10
Fix [346407]: Missing error-handling when MenuNewEntry() returns NULL check-in: 1512c574 user: jan.nijtmans tags: trunk, main
2026-10-25
07:57 • Ticket [3464070f] MenuNewEntry() return NULL -> no error msg status still Open with 4 other changes artifact: 01401f9c user: serhiy.storchaka
07:57
Fix [3464070fff]: when a menu entry could not be created, MenuNewEntry() freed it but left it in the entries array, and on Windows no error message was set. The slot is now removed again, and on Windows running out of menu command IDs gives "No more menu entries can be allocated." with error code TK MENU SYSTEM_RESOURCES. GetNewID() also tries the last allocated ID before giving up. New test winMenu-36.1. closed check-in: 18d8a385 user: serhiy.storchaka tags: menu-new-entry-error
2011-12-22
18:27 • New ticket [3464070f] MenuNewEntry() return NULL -> no error msg. artifact: 62c2de65 user: dgp

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.