You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tracking issue for 8 pre-existing bugs in the legacy GTK3 implementation files (now named *_gtk3.go after #5463). CodeRabbit's review of #5463 surfaced these — the lines were marked as changed by the file rename, but the bugs themselves predate the default-flip.
These were inherited verbatim from the pre-rename *_linux.go files (the GTK3 implementation that was the default before #5463). The mechanical rename in #5463 did not introduce them; it merely made CodeRabbit notice them. All affect the legacy-tags gtk3 build path only.
Findings
v3/pkg/application/application_linux_gtk3.go
Lines 156-168 — Early return nil skips startup handlers. After emitting ApplicationOpenedWithFile, the function returns immediately, skipping registration of the ApplicationStartup handler and the setupCommonEvents() / monitorThemeChanges() / monitorPowerEvents() calls. Either remove the early return so normal startup flow continues after the file-open event, or add a comment explaining why the abort is intentional.
Lines 249-260 — Out-of-bounds risk in getTheme.body[2] is read without ensuring len(body) >= 3. Also missing type-assert safety on body[2] → dbus.Variant and its Value() → string. Need len(body) >= 3 guard plus safe .(dbus.Variant) and .(string) assertions returning \"\", false on failure.
v3/pkg/application/linux_cgo_gtk3.go
Lines 569-573 — appName frees GLib-owned memory.C.g_get_application_name() returns a pointer to internal GLib storage; the defer C.free(unsafe.Pointer(name)) must be removed or the heap is corrupted. C.GoString already copies into Go memory.
Lines 697-701 — clipboardGet leaks gchar* from gtk_clipboard_wait_for_text. The returned C string must be freed with C.g_free after the C.GoString copy. Check for nil before convert; free after.
Lines 460-472 — Calloc.String / Calloc.Free use value receivers — append(c.pool, ...) modifies a copy; the pool never grows on the original. Change both methods to pointer receivers (*Calloc). Also clear the pool after free.
Lines 1838-1841 — zoomOut uses negative multiplier.ZoomInFactor := -1.10 yields a negative zoom that setZoom clamps to 1.0. Use the reciprocal: zoomOutFactor := 1.0/ZoomInFactor.
Lines 1095-1108 — execJS leaks a C.CString(\"\"). The empty-string allocation passed to webkit_web_view_evaluate_javascript is never freed. Either preallocate a shared empty C string symbol or explicitly free after the call.
v3/pkg/application/menuitem_linux_gtk3.go
Lines 79-85 — setHidden passes the hidden flag directly to widgetSetVisible — inverting behavior. Negate: widgetSetVisible(l.native, !hidden).
Lines 87-99 — setAccelerator has a development fmt.Println(\"setAccelerator\", accelerator) that should be removed (or routed through a proper logger guarded by a debug flag).
v3/pkg/application/menu_linux.go (and its _gtk3.go twin) — separately tracked
Pre-existing in master before #5463. The _gtk3.go files were renamed in-place from the pre-flip _linux.go files; the bugs predate the rename. Some of them likely predate #4958 too (the original GTK4 introduction PR).
PR #5463 is a mechanical default-flip — file renames, build constraint inversions, label updates. Bundling behavior fixes into the rename diff would have made the diff harder to review (and CodeRabbit's findings here prove the rename diff alone is already large enough).
Tracking issue for 8 pre-existing bugs in the legacy GTK3 implementation files (now named
*_gtk3.goafter #5463). CodeRabbit's review of #5463 surfaced these — the lines were marked as changed by the file rename, but the bugs themselves predate the default-flip.These were inherited verbatim from the pre-rename
*_linux.gofiles (the GTK3 implementation that was the default before #5463). The mechanical rename in #5463 did not introduce them; it merely made CodeRabbit notice them. All affect the legacy-tags gtk3build path only.Findings
v3/pkg/application/application_linux_gtk3.goreturn nilskips startup handlers. After emittingApplicationOpenedWithFile, the function returns immediately, skipping registration of theApplicationStartuphandler and thesetupCommonEvents()/monitorThemeChanges()/monitorPowerEvents()calls. Either remove the early return so normal startup flow continues after the file-open event, or add a comment explaining why the abort is intentional.getTheme.body[2]is read without ensuringlen(body) >= 3. Also missing type-assert safety onbody[2]→dbus.Variantand itsValue()→string. Needlen(body) >= 3guard plus safe.(dbus.Variant)and.(string)assertions returning\"\", falseon failure.v3/pkg/application/linux_cgo_gtk3.goappNamefrees GLib-owned memory.C.g_get_application_name()returns a pointer to internal GLib storage; thedefer C.free(unsafe.Pointer(name))must be removed or the heap is corrupted.C.GoStringalready copies into Go memory.clipboardGetleaksgchar*fromgtk_clipboard_wait_for_text. The returned C string must be freed withC.g_freeafter theC.GoStringcopy. Check for nil before convert; free after.Calloc.String/Calloc.Freeuse value receivers —append(c.pool, ...)modifies a copy; the pool never grows on the original. Change both methods to pointer receivers (*Calloc). Also clear the pool after free.zoomOutuses negative multiplier.ZoomInFactor := -1.10yields a negative zoom thatsetZoomclamps to 1.0. Use the reciprocal:zoomOutFactor := 1.0/ZoomInFactor.execJSleaks aC.CString(\"\"). The empty-string allocation passed towebkit_web_view_evaluate_javascriptis never freed. Either preallocate a shared empty C string symbol or explicitly free after the call.v3/pkg/application/menuitem_linux_gtk3.gosetHiddenpasses the hidden flag directly towidgetSetVisible— inverting behavior. Negate:widgetSetVisible(l.native, !hidden).setAcceleratorhas a developmentfmt.Println(\"setAccelerator\", accelerator)that should be removed (or routed through a proper logger guarded by a debug flag).v3/pkg/application/menu_linux.go(and its_gtk3.gotwin) — separately trackedprocessMenu()has a one-wayprocessedguard that makesMenu.Update()a no-op after the first call. Affects both stacks.Origin
Pre-existing in master before #5463. The
_gtk3.gofiles were renamed in-place from the pre-flip_linux.gofiles; the bugs predate the rename. Some of them likely predate #4958 too (the original GTK4 introduction PR).Why not in #5463
PR #5463 is a mechanical default-flip — file renames, build constraint inversions, label updates. Bundling behavior fixes into the rename diff would have made the diff harder to review (and CodeRabbit's findings here prove the rename diff alone is already large enough).
References
processedguard, which affects both stacks)