-
Notifications
You must be signed in to change notification settings - Fork 377
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
Changed how data pushed to lua is validated to use weak_ptr #469
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
480875c
Changed how data pushed to lua is validated to use weak_ptr based imp…
Shauren bd6de45
Require both aura and aura owner references to be valid for auras
Shauren ff9b7ca
Merge branch 'master' into use_weaks
Shauren 39eed65
Prevent cross-map access for lua values stored by earlier hook call
Shauren 0fae48d
Merge branch 'master' of https://github.com/ElunaLuaEngine/Eluna into…
Foereaper e3696b8
Wrap weak pointer implementation in ifdefs for now
Foereaper 7ba7506
Remove type casting functions only available in TrinityCore
Shauren 29d5388
Minimize ElunaObject differences between cores using unique_weak_ptr …
Shauren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may still want to have the old system to invalidate pushed objects at end of an event stack.
Or at some specific event, like at start of map updates starting.
One of the issues is that if you have an aura for example
aura = player:GetAura(spellid)
, then that aura will be valid until the aura object is destroyed.But as I understand, aura can be transferred to other maps with a player.
If we dont use some specific event to always invalidate objects, then it can happen that an aura or other object is transferred to another map and can be accessed from two lua states at the same time during map update events when we run multi-state mode eluna.
Any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you don't see this in the PR but aura handle is not invalidated when its destructor runs (which is delayed a bit, first it gets added to m_removedAuras list) but immediately when it is unapplied from unit (see TrinityCore/TrinityCore@a79b42b#diff-f3fb604c220161af7953902aecc9586825b8193413ab94fdeea4de5665d7a393R622)
But you are right about moving to another map - I will need to think about it since I was planning to use this outside of lua too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Luckily aura already has another reference it can additionally check, its WorldObject owner - so this is what I came up with e676a56
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are also Loot functions proposed here.
I wonder how cases like this should be handled where there is a new type exposed that does not necessarily have the unique_trackable_ptr.
I guess introducing new type would always require modifying the cores first to introduce the tracking and then the type can be exposed after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm starting to think its would be better to only allow preserving references for longer for some types, not all of them (using the old callbackid for the ones we want to exclude)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently the primary objects where storing the GUID and fetching the object is the norm is; players, creatures (units) and gameobjects. I'm guessing we can start with those at the very least and expand where it makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be addressed by 39eed65