-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Avoid using raw pointers in GetAllNewerThan results #4649
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
Avoid using raw pointers in GetAllNewerThan results #4649
Conversation
|
This Pull Request may conflict if the Pull Requests below are merged first. #4321 |
|
oh, wow! that's a lot of conflicting PRs for what I thought was a simple change 🙈 |
|
Can you convert this to using weak ptr? These really shouldn't be owning |
I'm not sure how to do this without a lot of refactoring in CGovernanceManager. A suggestion (or a post-merge followup) patch is welcome :) |
|
how about smth like 6321798 to avoid ownership? (shared_ptr changes may still be appropriate to prevent dangling, although I don't like it) This should be okay to simply cache these values as we continually call |
|
Also is dash/src/qt/governancelist.cpp Line 342 in 6321798
(please explain if I'm missing smth) |
|
I would propose a solution like 8a09264 as opposed to introducing shared_ptr usage here. It basically extends the lifetime of the lock, to the lifetime of the returned vector (whose values should be considered dangling after the lock expires). as opposed to creating some 40 shared_ptrs (relatively expensive) and extending the lifetime of the governance objects themselves, we only extend the time that we were locking the mutex. (although this ReturnWithLock struct maybe should have a different name, and maybe be in a different file) |
|
Any update on this? |
|
re, any update on this? |
9034c2c to
6167e10
Compare
pass copies around, fix gui updates and mem leaks
6167e10 to
f960bf3
Compare
PastaPastaPasta
left a comment
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.
utACK for squash merge
pass copies around, fix gui updates and mem leaks
pass copies around, fix gui updates and mem leaks
I believe this fixed some crashes for me in GUI (with Governance tab on).