Skip to content

Mark DataPacks as references in callback definitions #11

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

strafe
Copy link

@strafe strafe commented Mar 21, 2021

In 98f1126 the callback definitions were updated to transitional syntax. However, the ampersand indicating the DataPacks are passed by reference was dropped (I assume accidentally).

In their current state, no plugins are able to use these natives as you'll receive an error when trying to manipulate the Handle:

L 01/04/2021 - 02:17:16: [SM] Exception reported: Handle 18f8 cannot be cloned because it is invalid (error 4)
L 01/04/2021 - 02:17:16: [SM] Blaming: plugin.smx
L 01/04/2021 - 02:17:16: [SM] Call stack trace:
L 01/04/2021 - 02:17:16: [SM]   [0] CloneHandle
L 01/04/2021 - 02:17:16: [SM]   [1] Line 221, plugin.sp::QueryGameMEStatsReceived
L 01/04/2021 - 02:17:16: [SM]   [3] Call_Finish
L 01/04/2021 - 02:17:16: [SM]   [4] Line 4076, gameme.sp::gameme_raw_messag

This happens because the Handle is pushed with Call_PushCellRef rather than Call_PushCell, therefore requiring the prepended ampersand:

Call_StartFunction(data.callback_data_plugin, data.callback_data_function);
Call_PushCell(RAW_MESSAGE_CALLBACK_PLAYER);
Call_PushCell(data.callback_data_payload);
Call_PushCell(client);
Call_PushCellRef(pack);
Call_Finish(_:result);

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