diff 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
line wrap: on
line diff
--- a/mac/dw.m	Fri Jul 23 14:52:32 2021 +0000
+++ b/mac/dw.m	Fri Jul 23 15:28:42 2021 +0000
@@ -9386,10 +9386,14 @@
  */
 void API dw_menu_destroy(HMENUI *menu)
 {
-    NSMenu *thismenu = *menu;
-    DW_LOCAL_POOL_IN;
-    [thismenu release];
-    DW_LOCAL_POOL_OUT;
+    if(menu)
+    {
+        NSMenu *thismenu = *menu;
+        DW_LOCAL_POOL_IN;
+        [thismenu release];
+        DW_LOCAL_POOL_OUT;
+        *menu = NULL;
+    }
 }
 
 /* Handle deprecation of convertScreenToBase in 10.10 yet still supporting