Skip to content

Conversation

@Eshaan-byte
Copy link

Adds explicit unregister() methods following the pattern from luadevice_stop() and luanotifier_stop().

  • luanetfilter: adds unregister() and refactors cleanup into helper
  • luaxdp: adds unregister as alias for detach()
  • luahid: adds unregister() and refactors cleanup into helper

All use lunatik_unregisterobject() for explicit cleanup.

Fixes #403

@Eshaan-byte Eshaan-byte force-pushed the add-unregister-methods branch from 8753099 to 39d2c7d Compare January 25, 2026 00:00
luahid_delete(hid);

lunatik_object_t *runtime = hid->runtime;
if (runtime != NULL) {
Copy link
Contributor

Choose a reason for hiding this comment

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

please, don't mix cosmetic changes on new feat and fixes.. if you want to suggest changes on our code style, you are welcome to do so, but do it as a separate PR.

Copy link
Author

Choose a reason for hiding this comment

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

You're right, sorry about that. I will revert it. I'll keep style changes separate in the future.

Copy link
Contributor

Choose a reason for hiding this comment

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

please, let me know then I can give it another review round.. thanks..

Copy link
Author

Choose a reason for hiding this comment

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

Done! Reverted the cosmetic changes and kept the original != NULL style. Ready for another review round.

nf->runtime = NULL;
}

static void luanetfilter_release(void *private)
Copy link
Contributor

Choose a reason for hiding this comment

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

why having this indirection?

Copy link
Author

Choose a reason for hiding this comment

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

The helper avoids duplicating the cleanup logic in both release() and unregister(). I followed the same pattern from luadevice_delete() which is called from both luadevice_stop() and luadevice_release().

Happy to change it if you have a different approach in mind!

Copy link
Contributor

Choose a reason for hiding this comment

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

it's not the same, right? we don't simply call one in the other on luadevice.. in this case here, I think we should just call the nested function directly instead of having a indirect call.

Copy link
Author

Choose a reason for hiding this comment

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

You're right! I removed the helper function and inlined the cleanup code directly in both release() and unregister(). Changes pushed.

Adds explicit unregister() methods following the pattern from
luadevice_stop() and luanotifier_stop().

- luanetfilter: adds unregister() and refactors cleanup into helper
- luaxdp: adds unregister as alias for detach()
- luahid: adds unregister() and refactors cleanup into helper

All use lunatik_unregisterobject() for explicit cleanup.

Fixes luainkernel#403
@Eshaan-byte Eshaan-byte force-pushed the add-unregister-methods branch from 39d2c7d to f044600 Compare January 25, 2026 13:57
lunatik_object_t *object = lunatik_checkobject(L, 1);
luahid_t *hid = (luahid_t *)object->private;

lunatik_lock(object);
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you test it? It looks like a deadlock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

add unregister methods to luanetfilter, luaxdp, luaxtables, luahid

2 participants