detached 8ec5d1d

fix(webkit): address copilot PR review feedback - fix token collision, memory leak, build tags, and validation

commit
8ec5d1db362bbb977b4caaa937f494cb3292c629
author
Brice · · 2025-10-05 14:16 UTC
parent
1617d38
signature
unsigned
3 files · +12 -2
M pkg/webkit/thread_helpers.c +1 -0
@@ -1,3 +1,4 @@
1+//go:build webkit_cgo
12 // +build webkit_cgo
23
34 #include <glib.h>
@@ -1,3 +1,4 @@
1+//go:build webkit_cgo
1 // +build webkit_cgo2 // +build webkit_cgo
2 3
3 #include <glib.h>4 #include <glib.h>
M pkg/webkit/workspace_widgets_cgo.go +7 -0
@@ -183,6 +183,10 @@ static void widget_remove_focus_controller(GtkWidget* widget, GtkEventController
183183 }
184184
185185 tracker->is_attached = FALSE;
186+
187+ // Remove from registry and unref controller to avoid leaks
188+ g_hash_table_remove(controller_registry, controller);
189+ g_object_unref(controller);
186190 }
187191
188192 static GtkWidget* paned_get_start_child(GtkWidget* paned) {
@@ -591,6 +595,9 @@ func PanedGetPosition(paned uintptr) int {
591595 if paned == 0 {
592596 return 0
593597 }
598+ if !widgetIsValid(paned) {
599+ return 0
600+ }
594601 return int(C.gtk_paned_get_position((*C.GtkPaned)(unsafe.Pointer(paned))))
595602 }
596603
@@ -183,6 +183,10 @@ static void widget_remove_focus_controller(GtkWidget* widget, GtkEventController
183 }183 }
184 184
185 tracker->is_attached = FALSE;185 tracker->is_attached = FALSE;
186+
187+ // Remove from registry and unref controller to avoid leaks
188+ g_hash_table_remove(controller_registry, controller);
189+ g_object_unref(controller);
186 }190 }
187 191
188 static GtkWidget* paned_get_start_child(GtkWidget* paned) {192 static GtkWidget* paned_get_start_child(GtkWidget* paned) {
@@ -591,6 +595,9 @@ func PanedGetPosition(paned uintptr) int {
591 if paned == 0 {595 if paned == 0 {
592 return 0596 return 0
593 }597 }
598+ if !widgetIsValid(paned) {
599+ return 0
600+ }
594 return int(C.gtk_paned_get_position((*C.GtkPaned)(unsafe.Pointer(paned))))601 return int(C.gtk_paned_get_position((*C.GtkPaned)(unsafe.Pointer(paned))))
595 }602 }
596 603
M pkg/webkit/workspace_widgets_stub.go +4 -2
@@ -461,8 +461,10 @@ func WidgetQueueDraw(widget uintptr) {
461461
462462 // Focus controller functions for GTK4 EventControllerFocus (stub implementations)
463463 func WidgetAddFocusController(widget uintptr, onEnter, onLeave func()) uintptr {
464- // Stub implementation - return a fake token
465- return nextHoverToken
464+ // Stub implementation - return a unique token
465+ token := nextHoverToken
466+ nextHoverToken++
467+ return token
466468 }
467469
468470 func WidgetRemoveFocusController(widget uintptr, token uintptr) {
@@ -461,8 +461,10 @@ func WidgetQueueDraw(widget uintptr) {
461 461
462 // Focus controller functions for GTK4 EventControllerFocus (stub implementations)462 // Focus controller functions for GTK4 EventControllerFocus (stub implementations)
463 func WidgetAddFocusController(widget uintptr, onEnter, onLeave func()) uintptr {463 func WidgetAddFocusController(widget uintptr, onEnter, onLeave func()) uintptr {
464- // Stub implementation - return a fake token464+ // Stub implementation - return a unique token
465- return nextHoverToken465+ token := nextHoverToken
466+ nextHoverToken++
467+ return token
466 }468 }
467 469
468 func WidgetRemoveFocusController(widget uintptr, token uintptr) {470 func WidgetRemoveFocusController(widget uintptr, token uintptr) {

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