diff --git a/cef/cef-commponent-tray_window.go b/cef/cef-commponent-tray_window.go index 911ee3e4..e162dd72 100644 --- a/cef/cef-commponent-tray_window.go +++ b/cef/cef-commponent-tray_window.go @@ -12,6 +12,7 @@ package cef import ( + "fmt" . "github.com/energye/energy/common" "github.com/energye/energy/common/assetserve" . "github.com/energye/energy/consts" @@ -70,6 +71,9 @@ func (m *tCefTrayForm) Hide() { } func (m *tCefTrayForm) close() { + if m.isClosing { + return + } m.Hide() m.TForm.Close() } @@ -179,12 +183,14 @@ func (m *tCefTrayForm) createCefTrayWindow() { m.TForm.SetOnCloseQuery(func(sender lcl.IObject, canClose *bool) { *canClose = m.canClose + fmt.Println("tray close query", m.canClose) if m.isClosing { return } m.isClosing = true m.Hide() m.chromium.CloseBrowser(true) + m.trayIcon.Free() }) m.TForm.SetOnClose(func(sender lcl.IObject, action *types.TCloseAction) { *action = types.CaFree @@ -216,11 +222,6 @@ func (m *tCefTrayForm) createCefTrayWindow() { } }) m.chromium.SetOnClose(func(sender lcl.IObject, browser *ICefBrowser, aAction *TCefCloseBrowsesAction) { - if IsDarwin() { - *aAction = CbaDelay - } else { - *aAction = CbaClose - } if IsDarwin() { m.windowParent.DestroyChildWindow() } else { @@ -228,6 +229,7 @@ func (m *tCefTrayForm) createCefTrayWindow() { m.windowParent.Free() }) } + *aAction = CbaDelay }) m.chromium.SetOnBeforeClose(func(sender lcl.IObject, browser *ICefBrowser) { m.canClose = true