detached 850b471

Merge pull request #184 from bnema/fix/permission-request-crash

fix: prevent SIGABRT crash on permission-request signal
commit
850b471e60da7b69a3de8b735dea266697acbd7e
author
bnema · · 2026-03-06 06:02 UTC
committer
GitHub · · 2026-03-06 06:02 UTC
merge of
3458ddd + 30e77be · diff against the first parent
signature
GPG UnverifiedB5690EEEBB952194 The key is unknown
3 files · +28 -5
M go.mod +1 -1
@@ -3,7 +3,7 @@ module github.com/bnema/dumber
33 go 1.26
44
55 require (
6- github.com/bnema/puregotk-webkit v0.0.13
6+ github.com/bnema/puregotk-webkit v0.0.14
77 github.com/charmbracelet/bubbles v1.0.0
88 github.com/charmbracelet/bubbletea v1.3.10
99 github.com/charmbracelet/lipgloss v1.1.0
@@ -3,7 +3,7 @@ module github.com/bnema/dumber
3 go 1.263 go 1.26
4 4
5 require (5 require (
6- github.com/bnema/puregotk-webkit v0.0.136+ github.com/bnema/puregotk-webkit v0.0.14
7 github.com/charmbracelet/bubbles v1.0.07 github.com/charmbracelet/bubbles v1.0.0
8 github.com/charmbracelet/bubbletea v1.3.108 github.com/charmbracelet/bubbletea v1.3.10
9 github.com/charmbracelet/lipgloss v1.1.09 github.com/charmbracelet/lipgloss v1.1.0
M go.sum +2 -0
@@ -8,6 +8,8 @@ github.com/bnema/puregotk v0.1.0 h1:fNdoWi0wAEk5/rfwtpSeQuuB4AgAxkpiPPlivXXQk3I=
88 github.com/bnema/puregotk v0.1.0/go.mod h1:mZu8qSvCSqtVL+xoiebZuicnJijwrLfGRs6/eTVgFlc=
99 github.com/bnema/puregotk-webkit v0.0.13 h1:0j99i2a7GPhCQiIaV2LQ4n2p3Tw0q//V/CccDDU4M3A=
1010 github.com/bnema/puregotk-webkit v0.0.13/go.mod h1:wc+zzGdAy51YgyG1N3iwkQIusgCY4lFHGJUQgi4svJ0=
11+github.com/bnema/puregotk-webkit v0.0.14 h1:fwJ9fE3UKWQ8+VWFueddtfLMvcmO3EvfieIX/AYgHhY=
12+github.com/bnema/puregotk-webkit v0.0.14/go.mod h1:wc+zzGdAy51YgyG1N3iwkQIusgCY4lFHGJUQgi4svJ0=
1113 github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc=
1214 github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E=
1315 github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
@@ -8,6 +8,8 @@ github.com/bnema/puregotk v0.1.0 h1:fNdoWi0wAEk5/rfwtpSeQuuB4AgAxkpiPPlivXXQk3I=
8 github.com/bnema/puregotk v0.1.0/go.mod h1:mZu8qSvCSqtVL+xoiebZuicnJijwrLfGRs6/eTVgFlc=8 github.com/bnema/puregotk v0.1.0/go.mod h1:mZu8qSvCSqtVL+xoiebZuicnJijwrLfGRs6/eTVgFlc=
9 github.com/bnema/puregotk-webkit v0.0.13 h1:0j99i2a7GPhCQiIaV2LQ4n2p3Tw0q//V/CccDDU4M3A=9 github.com/bnema/puregotk-webkit v0.0.13 h1:0j99i2a7GPhCQiIaV2LQ4n2p3Tw0q//V/CccDDU4M3A=
10 github.com/bnema/puregotk-webkit v0.0.13/go.mod h1:wc+zzGdAy51YgyG1N3iwkQIusgCY4lFHGJUQgi4svJ0=10 github.com/bnema/puregotk-webkit v0.0.13/go.mod h1:wc+zzGdAy51YgyG1N3iwkQIusgCY4lFHGJUQgi4svJ0=
11+github.com/bnema/puregotk-webkit v0.0.14 h1:fwJ9fE3UKWQ8+VWFueddtfLMvcmO3EvfieIX/AYgHhY=
12+github.com/bnema/puregotk-webkit v0.0.14/go.mod h1:wc+zzGdAy51YgyG1N3iwkQIusgCY4lFHGJUQgi4svJ0=
11 github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc=13 github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc=
12 github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E=14 github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E=
13 github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=15 github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
M internal/infrastructure/webkit/webview.go +25 -4
@@ -1092,15 +1092,36 @@ const (
10921092 )
10931093
10941094 func detectPermissionRequestKind(ctx context.Context, requestPtr uintptr) permissionRequestKind {
1095- if isPermissionRequestType(ctx, requestPtr, webkit.UserMediaPermissionRequestGLibType()) {
1096- return permissionRequestKindUserMedia
1095+ if gtype, ok := safeGLibType(ctx, webkit.UserMediaPermissionRequestGLibType); ok {
1096+ if isPermissionRequestType(ctx, requestPtr, gtype) {
1097+ return permissionRequestKindUserMedia
1098+ }
10971099 }
1098- if isPermissionRequestType(ctx, requestPtr, webkit.DeviceInfoPermissionRequestGLibType()) {
1099- return permissionRequestKindDeviceInfo
1100+ if gtype, ok := safeGLibType(ctx, webkit.DeviceInfoPermissionRequestGLibType); ok {
1101+ if isPermissionRequestType(ctx, requestPtr, gtype) {
1102+ return permissionRequestKindDeviceInfo
1103+ }
11001104 }
11011105 return permissionRequestKindUnknown
11021106 }
11031107
1108+// safeGLibType calls a GType accessor function, recovering from panics caused
1109+// by unregistered (nil) puregotk function pointers. Returns the GType and true
1110+// on success, or zero and false if the call panicked.
1111+func safeGLibType(ctx context.Context, fn func() gtypes.GType) (gtype gtypes.GType, ok bool) {
1112+ defer func() {
1113+ if r := recover(); r != nil {
1114+ logging.FromContext(ctx).Warn().
1115+ Str("component", "permission").
1116+ Interface("panic", r).
1117+ Msg("GType accessor panicked (unregistered puregotk binding?)")
1118+ gtype = 0
1119+ ok = false
1120+ }
1121+ }()
1122+ return fn(), true
1123+}
1124+
11041125 func isPermissionRequestType(ctx context.Context, requestPtr uintptr, requestType gtypes.GType) bool {
11051126 return gobjectTypeCheckInstanceIsAByPtr(ctx, requestPtr, requestType)
11061127 }
@@ -1092,15 +1092,36 @@ const (
1092 )1092 )
1093 1093
1094 func detectPermissionRequestKind(ctx context.Context, requestPtr uintptr) permissionRequestKind {1094 func detectPermissionRequestKind(ctx context.Context, requestPtr uintptr) permissionRequestKind {
1095- if isPermissionRequestType(ctx, requestPtr, webkit.UserMediaPermissionRequestGLibType()) {1095+ if gtype, ok := safeGLibType(ctx, webkit.UserMediaPermissionRequestGLibType); ok {
1096- return permissionRequestKindUserMedia1096+ if isPermissionRequestType(ctx, requestPtr, gtype) {
1097+ return permissionRequestKindUserMedia
1098+ }
1097 }1099 }
1098- if isPermissionRequestType(ctx, requestPtr, webkit.DeviceInfoPermissionRequestGLibType()) {1100+ if gtype, ok := safeGLibType(ctx, webkit.DeviceInfoPermissionRequestGLibType); ok {
1099- return permissionRequestKindDeviceInfo1101+ if isPermissionRequestType(ctx, requestPtr, gtype) {
1102+ return permissionRequestKindDeviceInfo
1103+ }
1100 }1104 }
1101 return permissionRequestKindUnknown1105 return permissionRequestKindUnknown
1102 }1106 }
1103 1107
1108+// safeGLibType calls a GType accessor function, recovering from panics caused
1109+// by unregistered (nil) puregotk function pointers. Returns the GType and true
1110+// on success, or zero and false if the call panicked.
1111+func safeGLibType(ctx context.Context, fn func() gtypes.GType) (gtype gtypes.GType, ok bool) {
1112+ defer func() {
1113+ if r := recover(); r != nil {
1114+ logging.FromContext(ctx).Warn().
1115+ Str("component", "permission").
1116+ Interface("panic", r).
1117+ Msg("GType accessor panicked (unregistered puregotk binding?)")
1118+ gtype = 0
1119+ ok = false
1120+ }
1121+ }()
1122+ return fn(), true
1123+}
1124+
1104 func isPermissionRequestType(ctx context.Context, requestPtr uintptr, requestType gtypes.GType) bool {1125 func isPermissionRequestType(ctx context.Context, requestPtr uintptr, requestType gtypes.GType) bool {
1105 return gobjectTypeCheckInstanceIsAByPtr(ctx, requestPtr, requestType)1126 return gobjectTypeCheckInstanceIsAByPtr(ctx, requestPtr, requestType)
1106 }1127 }

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