changeset 2725:2dd68d2810ca

iOS: dw_messagebox() can't be called recursively... This might not be the best solution... but it prevents deadlocks for now.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 09 Dec 2021 20:07:39 +0000
parents c1f8e598960d
children 7a15401e73f4
files ios/dw.m
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ios/dw.m	Thu Dec 09 19:51:48 2021 +0000
+++ b/ios/dw.m	Thu Dec 09 20:07:39 2021 +0000
@@ -3431,6 +3431,12 @@
     UIAlertControllerStyle mstyle = UIAlertControllerStyleAlert;
     NSArray *params;
     va_list args;
+    static int in_mb = FALSE;
+
+    /* Prevent recursion */
+    if(in_mb)
+        return 0;
+    in_mb = TRUE;
 
     if(flags & DW_MB_OKCANCEL)
     {
@@ -3454,6 +3460,7 @@
 
     params = [NSMutableArray arrayWithObjects:mtitle, mtext, [NSNumber numberWithInteger:mstyle], button1, button2, button3, nil];
     [DWObj safeCall:@selector(messageBox:) withObject:params];
+    in_mb = FALSE;
     iResponse = [[params lastObject] integerValue];
 
     switch(iResponse)