comparison mac/dw.m @ 2615:ac51cbdcfbe5

dw_menu_destroy() should zero out the handle passed, GTK does this already. Also check the pointer is valid before using it in Mac and iOS.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 23 Jul 2021 15:28:42 +0000
parents 2acc7ba5dea0
children d17e3fb76bde
comparison
equal deleted inserted replaced
2614:dbcd9416e9c9 2615:ac51cbdcfbe5
9384 * Parameters: 9384 * Parameters:
9385 * menu: Handle of a menu. 9385 * menu: Handle of a menu.
9386 */ 9386 */
9387 void API dw_menu_destroy(HMENUI *menu) 9387 void API dw_menu_destroy(HMENUI *menu)
9388 { 9388 {
9389 NSMenu *thismenu = *menu; 9389 if(menu)
9390 DW_LOCAL_POOL_IN; 9390 {
9391 [thismenu release]; 9391 NSMenu *thismenu = *menu;
9392 DW_LOCAL_POOL_OUT; 9392 DW_LOCAL_POOL_IN;
9393 [thismenu release];
9394 DW_LOCAL_POOL_OUT;
9395 *menu = NULL;
9396 }
9393 } 9397 }
9394 9398
9395 /* Handle deprecation of convertScreenToBase in 10.10 yet still supporting 9399 /* Handle deprecation of convertScreenToBase in 10.10 yet still supporting
9396 * 10.6 and earlier since convertRectFromScreen was introduced in 10.7. 9400 * 10.6 and earlier since convertRectFromScreen was introduced in 10.7.
9397 */ 9401 */