Dispose releases the operating system resources, associated with the *WindowBase. If a user closes a *MainWindow or *Dialog, it is automatically released. Also, if a Container is disposed of, all its descendants will be released as well.
()
| 873 | // Also, if a Container is disposed of, all its descendants will be released |
| 874 | // as well. |
| 875 | func (wb *WindowBase) Dispose() { |
| 876 | for _, d := range wb.disposables { |
| 877 | d.Dispose() |
| 878 | } |
| 879 | |
| 880 | if wb.background != nil { |
| 881 | wb.background.detachWindow(wb) |
| 882 | } |
| 883 | |
| 884 | hWnd := wb.hWnd |
| 885 | if hWnd != 0 { |
| 886 | wb.disposingPublisher.Publish() |
| 887 | |
| 888 | wb.hWnd = 0 |
| 889 | if _, ok := hwnd2WindowBase[hWnd]; ok { |
| 890 | win.DestroyWindow(hWnd) |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | if cm := wb.contextMenu; cm != nil { |
| 895 | cm.actions.Clear() |
| 896 | cm.Dispose() |
| 897 | } |
| 898 | |
| 899 | if wb.shortcutActions != nil { |
| 900 | wb.shortcutActions.Clear() |
| 901 | } |
| 902 | |
| 903 | for _, p := range wb.name2Property { |
| 904 | p.SetSource(nil) |
| 905 | } |
| 906 | |
| 907 | if hWnd != 0 { |
| 908 | wb.group.accClearHwndProps(wb.hWnd) |
| 909 | wb.group.Done() |
| 910 | } |
| 911 | } |
| 912 | |
| 913 | // Disposing returns an Event that is published when the Window is disposed |
| 914 | // of. |
nothing calls this directly
no test coverage detected