Dispose of the window DB entry when no tabs are left (#866)

Fixes issue where closing the last tab in the last window would cause
app to show a blank window the next time it opens. Instead, we should
dispose of the window so that it can be created from scratch the next
time the app launches.

Also fixes a potential DB resource leak from dead windows cluttering up
the DB
This commit is contained in:
Evan Simkowitz 2024-09-26 12:48:40 -07:00 committed by GitHub
parent de92e53c38
commit df57896e2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,6 +76,7 @@ func (svc *WindowService) CloseTab(ctx context.Context, uiContext waveobj.UICont
} }
if window.ActiveTabId == tabId && tabIndex != -1 { if window.ActiveTabId == tabId && tabIndex != -1 {
if len(ws.TabIds) == 1 { if len(ws.TabIds) == 1 {
svc.CloseWindow(ctx, uiContext.WindowId)
eventbus.SendEventToElectron(eventbus.WSEventType{ eventbus.SendEventToElectron(eventbus.WSEventType{
EventType: eventbus.WSEvent_ElectronCloseWindow, EventType: eventbus.WSEvent_ElectronCloseWindow,
Data: uiContext.WindowId, Data: uiContext.WindowId,