chore(deps): bump purego-cef to v0.14.1
v0.14.0 pinned the CEF API 15000 contract and fixed the struct ABI corruption that made BrowserSettings.BackgroundColor land on chrome_status_bubble (transparent windowless canvas). v0.14.1 restores the global function bindings dropped by that regeneration (DictionaryValueCreate, V8ContextGetCurrentContext, all *Create factories) and fixes global factory ownership so created objects are adopted without a leaked reference. This makes the white-canvas fix in this branch effective: the opaque white BrowserSettings.BackgroundColor now actually reaches libcef.
- commit
- 902c404508da47722a324d2f14b2a4cfc04a2812
- author
- brice · · 2026-07-21 19:07 UTC
- parent
- 1dc7dd4
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
75 files · +1836 -1983
M go.mod +1 -1
| @@ -6,7 +6,7 @@ require ( | |||
| 6 | 6 | github.com/a-h/templ v0.3.1020 | |
| 7 | 7 | github.com/andybalholm/brotli v1.2.2 | |
| 8 | 8 | github.com/bnema/purego v0.11.0-bnema.4 | |
| 9 | - | github.com/bnema/purego-cef v0.13.4 | |
| 9 | + | github.com/bnema/purego-cef v0.14.1 | |
| 10 | 10 | github.com/bnema/purego-cef2gtk v0.8.5 | |
| 11 | 11 | github.com/bnema/purego-pipewire v0.1.5 | |
| 12 | 12 | github.com/bnema/purego-sqlite v0.1.4 | |
| @@ -6,7 +6,7 @@ require ( | |||||
| 6 | github.com/a-h/templ v0.3.1020 | 6 | github.com/a-h/templ v0.3.1020 | ||
| 7 | github.com/andybalholm/brotli v1.2.2 | 7 | github.com/andybalholm/brotli v1.2.2 | ||
| 8 | github.com/bnema/purego v0.11.0-bnema.4 | 8 | github.com/bnema/purego v0.11.0-bnema.4 | ||
| 9 | - | github.com/bnema/purego-cef v0.13.4 | 9 | + | github.com/bnema/purego-cef v0.14.1 |
| 10 | github.com/bnema/purego-cef2gtk v0.8.5 | 10 | github.com/bnema/purego-cef2gtk v0.8.5 | ||
| 11 | github.com/bnema/purego-pipewire v0.1.5 | 11 | github.com/bnema/purego-pipewire v0.1.5 | ||
| 12 | github.com/bnema/purego-sqlite v0.1.4 | 12 | github.com/bnema/purego-sqlite v0.1.4 | ||
M go.sum +2 -2 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_browser_gen.go +15 -2
| @@ -245,6 +245,19 @@ func wrapBrowser(ptr unsafe.Pointer) Browser { | |||
| 245 | 245 | return impl | |
| 246 | 246 | } | |
| 247 | 247 | ||
| 248 | + | // takeBrowser adopts a CEF Browser pointer whose reference is already owned by | |
| 249 | + | // the caller (as returned by a global factory function). Unlike wrapBrowser it | |
| 250 | + | // does NOT call AddRef, because the C API already transferred one reference to us. | |
| 251 | + | func takeBrowser(ptr unsafe.Pointer) Browser { | |
| 252 | + | if ptr == nil { | |
| 253 | + | return nil | |
| 254 | + | } | |
| 255 | + | r := (*capi.CEFBrowserT)(ptr) | |
| 256 | + | impl := &browserImpl{rawPtr: r} | |
| 257 | + | runtime.SetFinalizer(impl, (*browserImpl).Release) | |
| 258 | + | return impl | |
| 259 | + | } | |
| 260 | + | ||
| 248 | 261 | // RunFileDialogCallback Callback structure for cef_browser_host_t::RunFileDialog. The functions of this structure will be called on the browser process UI thread. | |
| 249 | 262 | type RunFileDialogCallback = portin.RunFileDialogCallback | |
| 250 | 263 | ||
| @@ -1317,11 +1330,11 @@ func BrowserHostCreateBrowserSync(windowinfo *WindowInfo, client RawClient, uRL | |||
| 1317 | 1330 | uRLStr := cefString(uRL) | |
| 1318 | 1331 | defer freeCefString(&uRLStr) | |
| 1319 | 1332 | ret := capi.CEFBrowserHostCreateBrowserSync(unsafe.Pointer(windowinfo), extractOrWrapRawPointer(client, func() any { return NewRawClient(client) }), unsafe.Pointer(&uRLStr), unsafe.Pointer(settings), extractRawPointer(extraInfo), extractRawPointer(requestContext)) | |
| 1320 | - | return wrapBrowser(ret) | |
| 1333 | + | return takeBrowser(ret) | |
| 1321 | 1334 | } | |
| 1322 | 1335 | ||
| 1323 | 1336 | // BrowserHostGetBrowserByIdentifier Returns the browser (if any) with the specified identifier. | |
| 1324 | 1337 | func BrowserHostGetBrowserByIdentifier(browserID int32) Browser { | |
| 1325 | 1338 | ret := capi.CEFBrowserHostGetBrowserByIdentifier(browserID) | |
| 1326 | - | return wrapBrowser(ret) | |
| 1339 | + | return takeBrowser(ret) | |
| 1327 | 1340 | } | |
| @@ -245,6 +245,19 @@ func wrapBrowser(ptr unsafe.Pointer) Browser { | |||||
| 245 | return impl | 245 | return impl | ||
| 246 | } | 246 | } | ||
| 247 | 247 | ||||
| 248 | + | // takeBrowser adopts a CEF Browser pointer whose reference is already owned by | |||
| 249 | + | // the caller (as returned by a global factory function). Unlike wrapBrowser it | |||
| 250 | + | // does NOT call AddRef, because the C API already transferred one reference to us. | |||
| 251 | + | func takeBrowser(ptr unsafe.Pointer) Browser { | |||
| 252 | + | if ptr == nil { | |||
| 253 | + | return nil | |||
| 254 | + | } | |||
| 255 | + | r := (*capi.CEFBrowserT)(ptr) | |||
| 256 | + | impl := &browserImpl{rawPtr: r} | |||
| 257 | + | runtime.SetFinalizer(impl, (*browserImpl).Release) | |||
| 258 | + | return impl | |||
| 259 | + | } | |||
| 260 | + | ||||
| 248 | // RunFileDialogCallback Callback structure for cef_browser_host_t::RunFileDialog. The functions of this structure will be called on the browser process UI thread. | 261 | // RunFileDialogCallback Callback structure for cef_browser_host_t::RunFileDialog. The functions of this structure will be called on the browser process UI thread. | ||
| 249 | type RunFileDialogCallback = portin.RunFileDialogCallback | 262 | type RunFileDialogCallback = portin.RunFileDialogCallback | ||
| 250 | 263 | ||||
| @@ -1317,11 +1330,11 @@ func BrowserHostCreateBrowserSync(windowinfo *WindowInfo, client RawClient, uRL | |||||
| 1317 | uRLStr := cefString(uRL) | 1330 | uRLStr := cefString(uRL) | ||
| 1318 | defer freeCefString(&uRLStr) | 1331 | defer freeCefString(&uRLStr) | ||
| 1319 | ret := capi.CEFBrowserHostCreateBrowserSync(unsafe.Pointer(windowinfo), extractOrWrapRawPointer(client, func() any { return NewRawClient(client) }), unsafe.Pointer(&uRLStr), unsafe.Pointer(settings), extractRawPointer(extraInfo), extractRawPointer(requestContext)) | 1332 | ret := capi.CEFBrowserHostCreateBrowserSync(unsafe.Pointer(windowinfo), extractOrWrapRawPointer(client, func() any { return NewRawClient(client) }), unsafe.Pointer(&uRLStr), unsafe.Pointer(settings), extractRawPointer(extraInfo), extractRawPointer(requestContext)) | ||
| 1320 | - | return wrapBrowser(ret) | 1333 | + | return takeBrowser(ret) |
| 1321 | } | 1334 | } | ||
| 1322 | 1335 | ||||
| 1323 | // BrowserHostGetBrowserByIdentifier Returns the browser (if any) with the specified identifier. | 1336 | // BrowserHostGetBrowserByIdentifier Returns the browser (if any) with the specified identifier. | ||
| 1324 | func BrowserHostGetBrowserByIdentifier(browserID int32) Browser { | 1337 | func BrowserHostGetBrowserByIdentifier(browserID int32) Browser { | ||
| 1325 | ret := capi.CEFBrowserHostGetBrowserByIdentifier(browserID) | 1338 | ret := capi.CEFBrowserHostGetBrowserByIdentifier(browserID) | ||
| 1326 | - | return wrapBrowser(ret) | 1339 | + | return takeBrowser(ret) |
| 1327 | } | 1340 | } | ||