fix(ui): avoid GTK critical on overlay removal
- commit
- 5a2d9504330a8ae12fe0e08c6c559b8c01f241ef
- author
- brice · · 2025-12-27 15:55 UTC
- parent
- 8556458
- signature
- unsigned
2 files · +17 -3
M internal/ui/app.go +5 -1
| @@ -525,7 +525,11 @@ func (a *App) attachTabPickerToActivePane() { | |||
| 525 | 525 | continue | |
| 526 | 526 | } | |
| 527 | 527 | if oldPV := view.GetPaneView(a.tabPickerPaneID); oldPV != nil { | |
| 528 | - | oldPV.RemoveOverlayWidget(a.tabPickerWidget) | |
| 528 | + | if parent := a.tabPickerWidget.GetParent(); parent == oldPV.Overlay() { | |
| 529 | + | oldPV.RemoveOverlayWidget(a.tabPickerWidget) | |
| 530 | + | } else if parent != nil { | |
| 531 | + | a.tabPickerWidget.Unparent() | |
| 532 | + | } | |
| 529 | 533 | break | |
| 530 | 534 | } | |
| 531 | 535 | } | |
| @@ -525,7 +525,11 @@ func (a *App) attachTabPickerToActivePane() { | |||||
| 525 | continue | 525 | continue | ||
| 526 | } | 526 | } | ||
| 527 | if oldPV := view.GetPaneView(a.tabPickerPaneID); oldPV != nil { | 527 | if oldPV := view.GetPaneView(a.tabPickerPaneID); oldPV != nil { | ||
| 528 | - | oldPV.RemoveOverlayWidget(a.tabPickerWidget) | 528 | + | if parent := a.tabPickerWidget.GetParent(); parent == oldPV.Overlay() { |
| 529 | + | oldPV.RemoveOverlayWidget(a.tabPickerWidget) | |||
| 530 | + | } else if parent != nil { | |||
| 531 | + | a.tabPickerWidget.Unparent() | |||
| 532 | + | } | |||
| 529 | break | 533 | break | ||
| 530 | } | 534 | } | ||
| 531 | } | 535 | } | ||
M internal/ui/component/workspace_view.go +12 -2
| @@ -608,7 +608,13 @@ func (wv *WorkspaceView) hideOmniboxInternal() { | |||
| 608 | 608 | ||
| 609 | 609 | // Remove from pane overlay | |
| 610 | 610 | if pv := wv.paneViews[wv.omniboxPaneID]; pv != nil && wv.omniboxWidget != nil { | |
| 611 | - | pv.RemoveOverlayWidget(wv.omniboxWidget) | |
| 611 | + | // The omnibox widget may have been reparented during a rebuild/move. | |
| 612 | + | // Avoid GTK criticals by only removing from the overlay that owns it. | |
| 613 | + | if parent := wv.omniboxWidget.GetParent(); parent == pv.Overlay() { | |
| 614 | + | pv.RemoveOverlayWidget(wv.omniboxWidget) | |
| 615 | + | } else if parent != nil { | |
| 616 | + | wv.omniboxWidget.Unparent() | |
| 617 | + | } | |
| 612 | 618 | } | |
| 613 | 619 | ||
| 614 | 620 | // Clear references | |
| @@ -715,7 +721,11 @@ func (wv *WorkspaceView) hideFindBarInternal() { | |||
| 715 | 721 | wv.findBar.Hide() | |
| 716 | 722 | ||
| 717 | 723 | if pv := wv.paneViews[wv.findBarPaneID]; pv != nil && wv.findBarWidget != nil { | |
| 718 | - | pv.RemoveOverlayWidget(wv.findBarWidget) | |
| 724 | + | if parent := wv.findBarWidget.GetParent(); parent == pv.Overlay() { | |
| 725 | + | pv.RemoveOverlayWidget(wv.findBarWidget) | |
| 726 | + | } else if parent != nil { | |
| 727 | + | wv.findBarWidget.Unparent() | |
| 728 | + | } | |
| 719 | 729 | } | |
| 720 | 730 | ||
| 721 | 731 | wv.findBar = nil | |
| @@ -608,7 +608,13 @@ func (wv *WorkspaceView) hideOmniboxInternal() { | |||||
| 608 | 608 | ||||
| 609 | // Remove from pane overlay | 609 | // Remove from pane overlay | ||
| 610 | if pv := wv.paneViews[wv.omniboxPaneID]; pv != nil && wv.omniboxWidget != nil { | 610 | if pv := wv.paneViews[wv.omniboxPaneID]; pv != nil && wv.omniboxWidget != nil { | ||
| 611 | - | pv.RemoveOverlayWidget(wv.omniboxWidget) | 611 | + | // The omnibox widget may have been reparented during a rebuild/move. |
| 612 | + | // Avoid GTK criticals by only removing from the overlay that owns it. | |||
| 613 | + | if parent := wv.omniboxWidget.GetParent(); parent == pv.Overlay() { | |||
| 614 | + | pv.RemoveOverlayWidget(wv.omniboxWidget) | |||
| 615 | + | } else if parent != nil { | |||
| 616 | + | wv.omniboxWidget.Unparent() | |||
| 617 | + | } | |||
| 612 | } | 618 | } | ||
| 613 | 619 | ||||
| 614 | // Clear references | 620 | // Clear references | ||
| @@ -715,7 +721,11 @@ func (wv *WorkspaceView) hideFindBarInternal() { | |||||
| 715 | wv.findBar.Hide() | 721 | wv.findBar.Hide() | ||
| 716 | 722 | ||||
| 717 | if pv := wv.paneViews[wv.findBarPaneID]; pv != nil && wv.findBarWidget != nil { | 723 | if pv := wv.paneViews[wv.findBarPaneID]; pv != nil && wv.findBarWidget != nil { | ||
| 718 | - | pv.RemoveOverlayWidget(wv.findBarWidget) | 724 | + | if parent := wv.findBarWidget.GetParent(); parent == pv.Overlay() { |
| 725 | + | pv.RemoveOverlayWidget(wv.findBarWidget) | |||
| 726 | + | } else if parent != nil { | |||
| 727 | + | wv.findBarWidget.Unparent() | |||
| 728 | + | } | |||
| 719 | } | 729 | } | ||
| 720 | 730 | ||||
| 721 | wv.findBar = nil | 731 | wv.findBar = nil | ||