Skip to content

device: Fix wgpuDeviceRelease() being called when releasing other objects#20

Closed
obiwac wants to merge 1 commit intocogentcore:mainfrom
obiwac:main
Closed

device: Fix wgpuDeviceRelease() being called when releasing other objects#20
obiwac wants to merge 1 commit intocogentcore:mainfrom
obiwac:main

Conversation

@obiwac
Copy link
Copy Markdown
Contributor

@obiwac obiwac commented May 8, 2026

A little confused about why this was being done in the first place - the fact that it's being done in multiple object release functions leads me to believe this was somehow intentional, but I really can't figure out why.

Either way, putting this PR up because it fixes texture freeing invalidating the device for a project of mine.

@oliverbestmann
Copy link
Copy Markdown

This is on purpose. e.g. look at your first change for buffers. in CreateBuffer there is an extra ref added to the device, which is then released once the buffer is released: https://github.com/cogentcore/webgpu/blob/main/wgpu/device.go#L329

This is done to simplify calling of some buffer related methods that would otherwise require you to pass the device again.

@rcoreilly
Copy link
Copy Markdown
Member

Ok so based on @oliverbestmann comments I'm going to close this one.

@rcoreilly rcoreilly closed this May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants