Mercurial > dwindows
comparison 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 |
comparison
equal
deleted
inserted
replaced
1376:52bbb1acce61 | 1377:b6249d66404c |
---|---|
5220 * Returns: | 5220 * Returns: |
5221 * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure. | 5221 * DW_ERROR_NONE (0) on success or DW_ERROR_UNKNOWN on failure. |
5222 */ | 5222 */ |
5223 int API dw_menu_delete_item(HMENUI menux, unsigned long id) | 5223 int API dw_menu_delete_item(HMENUI menux, unsigned long id) |
5224 { | 5224 { |
5225 if(id < 65536) | 5225 if(id < 65536 && menux) |
5226 { | 5226 { |
5227 WinSendMsg(menux, MM_DELETEITEM, MPFROM2SHORT(id, FALSE), 0); | 5227 WinSendMsg(menux, MM_DELETEITEM, MPFROM2SHORT(id, FALSE), 0); |
5228 /* If the ID was autogenerated it is safe to remove it */ | |
5229 if(id >= 30000) | |
5230 dw_signal_disconnect_by_window((HWND)id); | |
5228 return DW_ERROR_NONE; | 5231 return DW_ERROR_NONE; |
5229 } | 5232 } |
5230 return DW_ERROR_UNKNOWN; | 5233 return DW_ERROR_UNKNOWN; |
5231 } | 5234 } |
5232 | 5235 |