Mercurial > dwindows
comparison win/dw.c @ 469:7952b9c1dc07
Free menu memory on Windows as well.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 08 Oct 2003 21:59:23 +0000 |
parents | 0a2f13ba2d5c |
children | fc0341624711 |
comparison
equal
deleted
inserted
replaced
468:0a2f13ba2d5c | 469:7952b9c1dc07 |
---|---|
417 return TRUE; | 417 return TRUE; |
418 } | 418 } |
419 | 419 |
420 void _free_menu_data(HMENU menu) | 420 void _free_menu_data(HMENU menu) |
421 { | 421 { |
422 /* TODO: This needs to call this on all submenus */ | 422 #ifndef WINNT_COMPAT |
423 int i, count = GetMenuItemCount(menu); | |
424 | |
425 for(i=0;i<count;i++) | |
426 { | |
427 MENUITEMINFO mii; | |
428 | |
429 mii.cbSize = sizeof(MENUITEMINFO); | |
430 mii.fMask = MIIM_SUBMENU; | |
431 | |
432 if(GetMenuItemInfo(menu, i, TRUE, &mii) | |
433 && mii.hSubMenu) | |
434 _free_menu_data(mii.hSubMenu); | |
435 } | |
436 #endif | |
423 dw_signal_disconnect_by_name((HWND)menu, DW_SIGNAL_CLICKED); | 437 dw_signal_disconnect_by_name((HWND)menu, DW_SIGNAL_CLICKED); |
424 } | 438 } |
425 | 439 |
426 /* Convert to our internal color scheme */ | 440 /* Convert to our internal color scheme */ |
427 ULONG _internal_color(ULONG color) | 441 ULONG _internal_color(ULONG color) |
1871 info->ptMinTrackSize.y = 8; | 1885 info->ptMinTrackSize.y = 8; |
1872 return 0; | 1886 return 0; |
1873 } | 1887 } |
1874 break; | 1888 break; |
1875 case WM_DESTROY: | 1889 case WM_DESTROY: |
1876 /* Free memory before destroying */ | 1890 { |
1877 _free_window_memory(hWnd, 0); | 1891 HMENU menu = GetMenu(hWnd); |
1878 EnumChildWindows(hWnd, _free_window_memory, 0); | 1892 |
1893 if(menu) | |
1894 _free_menu_data(menu); | |
1895 | |
1896 /* Free memory before destroying */ | |
1897 _free_window_memory(hWnd, 0); | |
1898 EnumChildWindows(hWnd, _free_window_memory, 0); | |
1899 } | |
1879 break; | 1900 break; |
1880 case WM_CTLCOLORSTATIC: | 1901 case WM_CTLCOLORSTATIC: |
1881 case WM_CTLCOLORLISTBOX: | 1902 case WM_CTLCOLORLISTBOX: |
1882 case WM_CTLCOLORBTN: | 1903 case WM_CTLCOLORBTN: |
1883 case WM_CTLCOLOREDIT: | 1904 case WM_CTLCOLOREDIT: |
3391 */ | 3412 */ |
3392 int API dw_window_destroy(HWND handle) | 3413 int API dw_window_destroy(HWND handle) |
3393 { | 3414 { |
3394 HWND parent = GetParent(handle); | 3415 HWND parent = GetParent(handle); |
3395 Box *thisbox = (Box *)GetWindowLongPtr(parent, GWLP_USERDATA); | 3416 Box *thisbox = (Box *)GetWindowLongPtr(parent, GWLP_USERDATA); |
3417 #ifndef WINNT_COMPAT | |
3418 HMENU menu = GetMenu(handle); | |
3419 | |
3420 if(menu) | |
3421 _free_menu_data(menu); | |
3422 #endif | |
3396 | 3423 |
3397 if(parent != HWND_DESKTOP && thisbox && thisbox->count) | 3424 if(parent != HWND_DESKTOP && thisbox && thisbox->count) |
3398 { | 3425 { |
3399 int z, index = -1; | 3426 int z, index = -1; |
3400 Item *tmpitem, *thisitem = thisbox->items; | 3427 Item *tmpitem, *thisitem = thisbox->items; |