diff options
author | oehhar <harald.oehlmann@elmicron.de> | 2024-07-18 08:07:50 (GMT) |
---|---|---|
committer | oehhar <harald.oehlmann@elmicron.de> | 2024-07-18 08:07:50 (GMT) |
commit | f5a920f34101212852f51a1e9ed9fa88ca4dd9f2 (patch) | |
tree | 8589ca6b2f895d2055832a9ba63977ff16d31f2f /win | |
parent | 0179267bd9b6697599c3999abd30d668feee35ed (diff) | |
download | tk-f5a920f34101212852f51a1e9ed9fa88ca4dd9f2.zip tk-f5a920f34101212852f51a1e9ed9fa88ca4dd9f2.tar.gz tk-f5a920f34101212852f51a1e9ed9fa88ca4dd9f2.tar.bz2 |
Ticket [2d3a81c0] menubutton destroy segfault: preserve menu pointer in tkWinMenu.c, not in tkMenu.c, as for MacOS.
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinMenu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index a07765a..9d9e19c 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -1240,11 +1240,17 @@ TkWinHandleMenuEvent( interp = menuPtr->interp; Tcl_Preserve(interp); + /* + * 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); code = TkInvokeMenu(interp, menuPtr, mePtr->index); if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (menu invoke)"); Tcl_BackgroundException(interp, code); } + Tcl_Release(menuPtr); Tcl_Release(interp); *plResult = 0; returnResult = 1; |