Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macos guiwidget #102

Merged
merged 3 commits into from
Nov 23, 2024
Merged

Macos guiwidget #102

merged 3 commits into from
Nov 23, 2024

Conversation

geon
Copy link
Contributor

@geon geon commented Nov 2, 2024

I implemented the GuiWidget as discussed here: #100 . Not sure I got it right though.

The EventUserData objects are allocated. They should probably be freed at some point? I don't know how I would do that.

@zenith391
Copy link
Member

Hi! Sorry for the late answer!

Yes the EventUserData objects should be freed. For this, there's the deinit function implemented (currently as a no-op) in Events. It could probably be like:

pub fn deinit(self: *const T) void {
  const peer = self.peer; // each component has a peer, so you can use the 'peer' field.
  lib.internal.lasting_allocator.destroy(peer.data);
}

One side note: you should use lib.internal.lasting_allocator instead of lib.internal.scratch_allocator, as the scratch_allocator is intended more for very short allocations (like UTF-8/UTF-16 conversions).

@geon
Copy link
Contributor Author

geon commented Nov 16, 2024

Hi! Sorry for the late answer!

No worries! We all have limited time.

I fixed the allocations and added the deinit implementation.

@zenith391 zenith391 merged commit 08c7310 into capy-ui:master Nov 23, 2024
0 of 2 checks passed
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.

2 participants