diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-02-27 13:16:47 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2019-02-27 13:16:47 +0100 |
| commit | 58119f412d50e774b8068fe6fc7a6de659759a3b (patch) | |
| tree | 800933350466d9a9854ad5b4950b3b3a547a1bf1 | |
| parent | 3d57d9136b2032a050c0cbed4546896934095499 (diff) | |
Simplifies memory allocation of system menu items for FL_SUBMENU_POINTER
| -rw-r--r-- | src/Fl_MacOS_Sys_Menu_Bar.mm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Fl_MacOS_Sys_Menu_Bar.mm b/src/Fl_MacOS_Sys_Menu_Bar.mm index 1c0e3309b..2a4fdd304 100644 --- a/src/Fl_MacOS_Sys_Menu_Bar.mm +++ b/src/Fl_MacOS_Sys_Menu_Bar.mm @@ -192,8 +192,9 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@"; NSInteger index = (fl_sys_menu_bar ? fl_sys_menu_bar->find_index(mitem) : -1); [item setTag:index]; if (index < 0) { - NSData *pointer = [NSData dataWithBytes:&mitem length:sizeof(Fl_Menu_Item*)]; + NSData *pointer = [[NSData alloc] initWithBytes:&mitem length:sizeof(Fl_Menu_Item*)]; [item setRepresentedObject:pointer]; + [pointer release];//pointer will dealloc each time item dealloc's } [menu addItem:item]; [item setTarget:item]; |
