···239239 C.ghostty_terminal_set(
240240 t.ptr,
241241 C.GHOSTTY_TERMINAL_OPT_USERDATA,
242242- unsafe.Pointer(t.handle),
242242+ handleToPointer(t.handle),
243243 )
244244245245 // Register any effects that were provided via options.
···408408 }
409409 return &GridRef{ref: ref}, nil
410410}
411411+412412+// handleToPointer converts a cgo.Handle (uintptr) to unsafe.Pointer
413413+// for passing as C userdata. The handle is an opaque integer, not a
414414+// real Go pointer, so we suppress checkptr which would otherwise
415415+// reject it under -race.
416416+//
417417+//go:nocheckptr
418418+func handleToPointer(h cgo.Handle) unsafe.Pointer {
419419+ return unsafe.Pointer(h)
420420+}