Mercurial > dwindows
diff os2/dw.c @ 1377:b6249d66404c
Cleanup signal handlers when calling dw_menu_delete_item() on OS/2 and Windows...
when the ID is auto-generated. It is unsafe to do it for specified IDs because there
may be more than one menu item with an ID... however autogenerated IDs should be unique.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 23 Nov 2011 00:49:12 +0000 |
parents | 8e27dd96a97e |
children | 3ba4853d5b78 |
line wrap: on
line diff
--- a/os2/dw.c Tue Nov 22 22:20:39 2011 +0000 +++ b/os2/dw.c Wed Nov 23 00:49:12 2011 +0000 @@ -5222,9 +5222,12 @@ */ int API dw_menu_delete_item(HMENUI menux, unsigned long id) { - if(id < 65536) + if(id < 65536 && menux) { WinSendMsg(menux, MM_DELETEITEM, MPFROM2SHORT(id, FALSE), 0); + /* If the ID was autogenerated it is safe to remove it */ + if(id >= 30000) + dw_signal_disconnect_by_window((HWND)id); return DW_ERROR_NONE; } return DW_ERROR_UNKNOWN;