Skip to content

Conversation

@UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Dec 30, 2021

I believe this fixed some crashes for me in GUI (with Governance tab on).

@UdjinM6 UdjinM6 added this to the 18 milestone Dec 30, 2021
@github-actions
Copy link

This Pull Request may conflict if the Pull Requests below are merged first.

#4321
conflictable files: src/rpc/governance.cpp
#4357
conflictable files: src/interfaces/node.cpp
#4478
conflictable files: src/interfaces/node.cpp
#4532
conflictable files: src/interfaces/node.cpp,src/interfaces/node.h
#4465
conflictable files: src/governance/governance.cpp,src/governance/governance.h
#4491
conflictable files: src/governance/governance.cpp
#4506
conflictable files: src/governance/governance.cpp,src/rpc/governance.cpp
#4629
conflictable files: src/qt/governancelist.cpp,src/qt/governancelist.h
#4512
conflictable files: src/rpc/governance.cpp
#4623
conflictable files: src/interfaces/node.cpp,src/qt/clientmodel.cpp

@UdjinM6
Copy link
Author

UdjinM6 commented Dec 30, 2021

oh, wow! that's a lot of conflicting PRs for what I thought was a simple change 🙈

@PastaPastaPasta
Copy link
Member

Can you convert this to using weak ptr? These really shouldn't be owning

@UdjinM6
Copy link
Author

UdjinM6 commented Jan 3, 2022

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 :)

@PastaPastaPasta
Copy link
Member

PastaPastaPasta commented Jan 3, 2022

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 updateProposalList via a timer, which creates brand new Proposal objects each time.

@PastaPastaPasta
Copy link
Member

Also is

newProposals.emplace_back(new Proposal(pGovObj, proposalModel, nAbsVoteReq));
a mem leak? @UdjinM6 @5tefan

(please explain if I'm missing smth)

@PastaPastaPasta
Copy link
Member

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)

@UdjinM6 UdjinM6 marked this pull request as draft January 11, 2022 01:08
@PastaPastaPasta
Copy link
Member

Any update on this?

@PastaPastaPasta
Copy link
Member

re, any update on this?

@UdjinM6 UdjinM6 force-pushed the no_raw_pointers_in_GetAllNewerThan branch from 9034c2c to 6167e10 Compare February 12, 2022 19:59
pass copies around, fix gui updates and mem leaks
@UdjinM6 UdjinM6 force-pushed the no_raw_pointers_in_GetAllNewerThan branch from 6167e10 to f960bf3 Compare February 14, 2022 18:47
@UdjinM6 UdjinM6 marked this pull request as ready for review February 14, 2022 18:48
Copy link
Member

@PastaPastaPasta PastaPastaPasta left a 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

@UdjinM6 UdjinM6 merged commit aa7c03f into dashpay:develop Feb 15, 2022
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Nov 14, 2023
pass copies around, fix gui updates and mem leaks
gades pushed a commit to piratecash/pirate that referenced this pull request Dec 9, 2023
pass copies around, fix gui updates and mem leaks
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