detached b03b1e9

fix: disconnect back-forward list signal from correct object

Store back-forward list reference and its signal ID separately.
Disconnect from the correct object (back-forward list) instead of WebView
to prevent silent disconnection failures that could cause panics or leaks.
In GObject, signal handlers must be disconnected from the same object
they were connected to.
commit
b03b1e994518b28a88a57e9546518e54bc1129db
author
brice · · 2026-01-29 05:09 UTC
parent
2255773
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +12 -1
M internal/infrastructure/webkit/webview.go +12 -1
@@ -163,6 +163,9 @@ type WebView struct {
163163 // findController is cached to prevent GC from collecting the Go wrapper
164164 findController *findControllerAdapter
165165 findControllerOnce sync.Once
166+
167+ backForwardList *webkit.BackForwardList
168+ backForwardListSignalID uint32
166169 }
167170
168171 type findControllerAdapter struct {
@@ -853,7 +856,8 @@ func (wv *WebView) connectBackForwardListChangedSignal() {
853856 wv.mu.Unlock()
854857 }
855858 sigID := backForwardList.ConnectChanged(&changedCb)
856- wv.signalIDs = append(wv.signalIDs, sigID)
859+ wv.backForwardList = backForwardList
860+ wv.backForwardListSignalID = sigID
857861 }
858862
859863 // ID returns the unique identifier for this WebView.
@@ -1236,6 +1240,13 @@ func (wv *WebView) DisconnectSignals() {
12361240 }
12371241 wv.signalIDs = wv.signalIDs[:0] // Clear the slice
12381242
1243+ if wv.backForwardList != nil && wv.backForwardListSignalID != 0 {
1244+ bfObj := gobject.ObjectNewFromInternalPtr(wv.backForwardList.GoPointer())
1245+ gobject.SignalHandlerDisconnect(bfObj, wv.backForwardListSignalID)
1246+ wv.backForwardListSignalID = 0
1247+ wv.backForwardList = nil
1248+ }
1249+
12391250 wv.logger.Debug().Uint64("id", uint64(wv.id)).Msg("signals disconnected")
12401251 }
12411252
@@ -163,6 +163,9 @@ type WebView struct {
163 // findController is cached to prevent GC from collecting the Go wrapper163 // findController is cached to prevent GC from collecting the Go wrapper
164 findController *findControllerAdapter164 findController *findControllerAdapter
165 findControllerOnce sync.Once165 findControllerOnce sync.Once
166+
167+ backForwardList *webkit.BackForwardList
168+ backForwardListSignalID uint32
166 }169 }
167 170
168 type findControllerAdapter struct {171 type findControllerAdapter struct {
@@ -853,7 +856,8 @@ func (wv *WebView) connectBackForwardListChangedSignal() {
853 wv.mu.Unlock()856 wv.mu.Unlock()
854 }857 }
855 sigID := backForwardList.ConnectChanged(&changedCb)858 sigID := backForwardList.ConnectChanged(&changedCb)
856- wv.signalIDs = append(wv.signalIDs, sigID)859+ wv.backForwardList = backForwardList
860+ wv.backForwardListSignalID = sigID
857 }861 }
858 862
859 // ID returns the unique identifier for this WebView.863 // ID returns the unique identifier for this WebView.
@@ -1236,6 +1240,13 @@ func (wv *WebView) DisconnectSignals() {
1236 }1240 }
1237 wv.signalIDs = wv.signalIDs[:0] // Clear the slice1241 wv.signalIDs = wv.signalIDs[:0] // Clear the slice
1238 1242
1243+ if wv.backForwardList != nil && wv.backForwardListSignalID != 0 {
1244+ bfObj := gobject.ObjectNewFromInternalPtr(wv.backForwardList.GoPointer())
1245+ gobject.SignalHandlerDisconnect(bfObj, wv.backForwardListSignalID)
1246+ wv.backForwardListSignalID = 0
1247+ wv.backForwardList = nil
1248+ }
1249+
1239 wv.logger.Debug().Uint64("id", uint64(wv.id)).Msg("signals disconnected")1250 wv.logger.Debug().Uint64("id", uint64(wv.id)).Msg("signals disconnected")
1240 }1251 }
1241 1252

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close