detached 6ca9b37

fix(webkit): add IsDestroyed safety checks to keyboard blocking handlers to prevent crashes on destroyed WebViews

commit
6ca9b37a4bce7eb3737870981aacd04ce7a49915
author
bamen · · 2025-09-22 17:12 UTC
committer
bamen · · 2025-09-22 17:05 UTC
parent
4f57229
signature
unsigned
2 files · +5 -2
M pkg/webkit/keyboard_cgo.go +1 -1
@@ -758,7 +758,7 @@ func handleRenderingBackendMessage(payload string) bool {
758758
759759 // handleKeyboardBlockingMessage handles keyboard blocking control messages from omnibox
760760 func handleKeyboardBlockingMessage(vw *WebView, payload string) bool {
761- if vw == nil {
761+ if vw == nil || vw.IsDestroyed() {
762762 return false
763763 }
764764
@@ -758,7 +758,7 @@ func handleRenderingBackendMessage(payload string) bool {
758 758
759 // handleKeyboardBlockingMessage handles keyboard blocking control messages from omnibox759 // handleKeyboardBlockingMessage handles keyboard blocking control messages from omnibox
760 func handleKeyboardBlockingMessage(vw *WebView, payload string) bool {760 func handleKeyboardBlockingMessage(vw *WebView, payload string) bool {
761- if vw == nil {761+ if vw == nil || vw.IsDestroyed() {
762 return false762 return false
763 }763 }
764 764
M pkg/webkit/shortcuts_cgo.go +4 -1
@@ -529,7 +529,10 @@ func (w *WebView) DisablePageKeyboardBlocking() error {
529529 console.log('[dumber] Page keyboard event blocking disabled');
530530 }
531531 `
532- w.InjectScript(cleanupScript)
532+ // Double-check WebView is still valid before script injection
533+ if !w.IsDestroyed() {
534+ w.InjectScript(cleanupScript)
535+ }
533536
534537 // Remove the user script if it exists
535538 if keyboardBlockerScript != nil {
@@ -529,7 +529,10 @@ func (w *WebView) DisablePageKeyboardBlocking() error {
529 console.log('[dumber] Page keyboard event blocking disabled');529 console.log('[dumber] Page keyboard event blocking disabled');
530 }530 }
531 `531 `
532- w.InjectScript(cleanupScript)532+ // Double-check WebView is still valid before script injection
533+ if !w.IsDestroyed() {
534+ w.InjectScript(cleanupScript)
535+ }
533 536
534 // Remove the user script if it exists537 // Remove the user script if it exists
535 if keyboardBlockerScript != nil {538 if keyboardBlockerScript != nil {

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