Mercurial > dwindows
diff ios/dw.m @ 2600:0bb974e70435
iOS: Fix crash by retaining the UIMenu returned in the block.
Hopefully the UIMenu gets released by the system after use or we may leak.
Remove some the debug code to dump the responder chain.
Remove probably unused identifier and replace it with nil.
Container context menus now work, but the window menu isn't showing.
We no longer get the error anymore however at least.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 11 Jul 2021 08:49:26 +0000 |
parents | 32728f6f7ccd |
children | 3201f9e9067b |
line wrap: on
line diff
--- a/ios/dw.m Sat Jul 10 23:57:25 2021 +0000 +++ b/ios/dw.m Sun Jul 11 08:49:26 2021 +0000 @@ -269,15 +269,6 @@ CGContextRef _dw_draw_context(id image, bool antialias); typedef id (*DWIMP)(id, SEL, ...); -void _dw_display_responder_chain(id window) -{ - NSLog(@"=== Starting responder chain dump ===\n"); - do { - NSLog(@"%@\n", [window description]); - } while((window = [window nextResponder])); - NSLog(@"=== Responder chain dump complete ===\n"); -} - /* Internal function to queue a window redraw */ void _dw_redraw(id window, int skip) { @@ -1392,8 +1383,9 @@ if(windowmenu && !item.rightBarButtonItem) { + UIMenu *menu = [windowmenu menu]; UIBarButtonItem *options = [[UIBarButtonItem alloc] initWithImage:[UIImage systemImageNamed:@"list.bullet"] - menu:[windowmenu menu]]; + menu:menu]; item.rightBarButtonItem = options; } } else { @@ -2091,9 +2083,8 @@ if(window) { - __block UIMenu *popupmenu = [[window popupMenu] menu]; - _dw_display_responder_chain(tableView); - config = [UIContextMenuConfiguration configurationWithIdentifier:@"DWContextMenu" + __block UIMenu *popupmenu = [[[window popupMenu] menu] retain]; + config = [UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:nil actionProvider:^(NSArray* suggestedAction){return popupmenu;}]; [window setPopupMenu:nil];