MCPcopy
hub / github.com/lxn/walk / Dispose

Method Dispose

window.go:875–911  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

873// Also, if a Container is disposed of, all its descendants will be released
874// as well.
875func (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.

Callers

nothing calls this directly

Calls 7

accClearHwndPropsMethod · 0.80
DoneMethod · 0.80
DisposeMethod · 0.65
detachWindowMethod · 0.65
SetSourceMethod · 0.65
PublishMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected