comparison win/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 896347a9be19
children cc66b6d4b74e
comparison
equal deleted inserted replaced
1376:52bbb1acce61 1377:b6249d66404c
5213 HMENU mymenu = (HMENU)menux; 5213 HMENU mymenu = (HMENU)menux;
5214 5214
5215 if ( IsWindow(menux) && !IsMenu(mymenu) ) 5215 if ( IsWindow(menux) && !IsMenu(mymenu) )
5216 mymenu = (HMENU)dw_window_get_data(menux, "_dw_menu"); 5216 mymenu = (HMENU)dw_window_get_data(menux, "_dw_menu");
5217 5217
5218 if ( DeleteMenu(mymenu, id, MF_BYCOMMAND) == 0 ) 5218 if ( mymenu == 0 || DeleteMenu(mymenu, id, MF_BYCOMMAND) == 0 )
5219 return DW_ERROR_UNKNOWN; 5219 return DW_ERROR_UNKNOWN;
5220 5220
5221 /* If the ID was autogenerated it is safe to remove it */
5222 if(id >= 30000)
5223 dw_signal_disconnect_by_window((HWND)id);
5224
5225 /* Make sure the menu is redrawn if needed */
5221 if( (HMENU)menux != mymenu ) 5226 if( (HMENU)menux != mymenu )
5222 DrawMenuBar(menux); 5227 DrawMenuBar(menux);
5223 return DW_ERROR_NONE; 5228 return DW_ERROR_NONE;
5224 } 5229 }
5225 5230