diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2024-07-18 07:48:06 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2024-07-18 07:48:06 (GMT) |
commit | 0179267bd9b6697599c3999abd30d668feee35ed (patch) | |
tree | f0c6ec81c48440574ed1021f57ae618c093e9dca /generic | |
parent | 405cd1740e12c6b84187670afbaf7f835310c288 (diff) | |
download | tk-0179267bd9b6697599c3999abd30d668feee35ed.zip tk-0179267bd9b6697599c3999abd30d668feee35ed.tar.gz tk-0179267bd9b6697599c3999abd30d668feee35ed.tar.bz2 |
Ticket [2d3a81c0] menubutton destroy segfault: proposed solution to preserve also the menu
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkMenu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/generic/tkMenu.c b/generic/tkMenu.c index 715c6d7..15c8031 100644 --- a/generic/tkMenu.c +++ b/generic/tkMenu.c @@ -1005,6 +1005,11 @@ TkInvokeMenu( goto done; } + /* + * Tk Bug 2d3a81c0: menu may be freed in callback, but menu item is + * preserved. As menu is required to delete menu item later, it segfaults. + */ + Tcl_Preserve(menuPtr); Tcl_Preserve(mePtr); if (mePtr->type == TEAROFF_ENTRY) { Tcl_DString ds; @@ -1062,6 +1067,7 @@ TkInvokeMenu( Tcl_DecrRefCount(commandPtr); } Tcl_Release(mePtr); + Tcl_Release(menuPtr); done: return result; |