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

Fixes, and rework anti-GC dict #11

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Conversation

Dragorn421
Copy link
Contributor

@Dragorn421 Dragorn421 commented Dec 23, 2022

  • WIP: Fix clearing buffers/callbacks, allow it by passing None to the pygfxd wrappers (WIP, not everything done yet)
  • Rework the anti-GC dict (the dictionary that stores ctype'd callbacks to protect them from garbage collection)
  • Fix pygfxd's gfxd_arg_fn takes int fn(void) but libgfxd expects void fn(int) #10
  • Fix gfxd_arg_value, gfxd_value_by_type bindings when libgfxd returns NULL, and improve how it works too

The first point is WIP, will un-draft when it's done.
Before proceeding though, I'd like to know if I should carry on or change some things. So, any opinions?

This passes my wip tests from #7 (or at least it passes them now that the tests made me notice an issue pepeLaugh)

pygfxd.py Outdated
Comment on lines 392 to 420
cb = CFUNCTYPE(c_int, c_void_p, c_int)(fn)
__gfxd_buffers_callbacks.update({102 : cb})
lgfxd.gfxd_input_callback(cb)
if fn is not None:
cb = CFUNCTYPE(c_int, c_void_p, c_int)(fn)
__gfxd_buffers_callbacks[gfxd_input_callback] = cb
lgfxd.gfxd_input_callback(cb)
else:
lgfxd.gfxd_input_callback(CFUNCTYPE(c_int, c_void_p, c_int)())
del __gfxd_buffers_callbacks[gfxd_input_callback]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically, is this looking good to you?

@Dragorn421 Dragorn421 changed the title Fixes and rework anti-GC dict Fixes, and rework anti-GC dict Dec 23, 2022
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.

1 participant